// [CP-CHAP-11] TEST aplicación estilo como parámetro
// Prueba orientada a comprobar que la aplicación del estilo se puede realizar
// con anterioridad a tener la capa cargada en el mapa sin tener que esperar a un evt LOAD
// 1.- Comprobación de creación de capa con estilo - La capa se inicializa marrón
// 2.- Comprobación seteo de estilo antes de la carga - la capa se inicializa azul (DESCOMENTAR ////CP-PASO-2 y ejecutar sin activar función on.(M.evt.LOAD...)
let mapajs = M.map({
'container': 'map',
"controls": ["layerswitcher", "mouse", "scale", "overviewmap", "panzoombar", "scaleline", ],
"getfeatureinfo": "plain",
bbox: [204658, 4119745, 266622, 4158094]
});
let estilo = new M.style.Polygon({
fill: {
color: 'brown',
}
});
let estilo2 = new M.style.Polygon({
fill: {
color: 'blue',
}
});
let poblacion = new M.layer.WFS({
name: "Población",
url: "https://clientes.guadaltel.es/desarrollo/geossigc/wfs?bbox=204658,4119745,266622,4158094",
namespace: "mapea",
name: "nucleos_datos_poblacion",
legend: "poblacion",
getfeatureinfo: "plain",
geometry: 'POLYGON',
//bbox: [204658,4119745,266622,4158094], --> SERÍA INTERESANTE
extract: true
}/*, {
style: estilo
}*/);
poblacion.setStyle(estilo);/// --> debería poder hacerse sin el LOAD
//// poblacion.on(M.evt.LOAD, function() {
////CP-PASO-2 poblacion.setStyle(estilo2);
////});
mapajs.addLayers(poblacion);
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.