// Caso de pruebas V4_2_0 SIMB - POL - Plantilla atributos
// 1.- Carga capa WFS de polígonos
// 2.- Establece un atributo adicional del que se obtendrá el color. -- Si se quiere utilizar
// 3.- Se define estilo con color asignado a través de atributo procedente de la capa
// 4.- Pulsar Aplicar estilo debe mostrar la capa con el color definido en el layer para el atributo en cada feature.
var mapajs = M.map({
'container': 'map',
"controls": ["layerswitcher", "mouse", "scale", "overviewmap", "panzoombar", "scaleline",],
"getfeatureinfo": "plain"
});
var municipios = new M.layer.WFS({
name: "Municipios",
url: "https://clientes.guadaltel.es/desarrollo/geossigc/wfs?",
namespace: "mapea",
name: "da_municipio_pol",
legend: "Municipios - Plantilla Símbolo",
getfeatureinfo:"plain",
geometry: 'POLYGON',
extract: true,
});
municipios.on(M.evt.LOAD, function() {
municipios.setStyle(new M.style.Polygon({
stroke: {
color: 'red'
}
}));
}
)
let plantillaStyle = new M.style.Polygon({
fill: {
color: '{{cod_ine_provincia}}',
}
});
mapajs.addLayers(municipios);
mapajs.addPlugin(new M.plugin.AttributeTable());
function setCategoriaStyle(){
if (municipios == null ) return;
municipios.setStyle(plantillaStyle);
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.