// Caso de pruebas CP-071-03 - SIMB - LIN - Plantilla atributos
// 1.- Carga capa WFS de puntos
// 2.- Establece un atributo adicional del que se obtendrá el color.
// 3.- Pulsar Aplicar estilo debe mostrar la capa con el color definido para el atributo en cada feature.
// 4.- El canvas de la capa no muestra leyenda porque no se dispone de estilo de color-.
var mapajs = M.map({
'container': 'map',
"controls": ["layerswitcher", "mouse", "scale", "overviewmap", "panzoombar", "scaleline",],
"getfeatureinfo": "plain"
});
let points = new M.layer.WFS({
name: "Centros ASSDA - Subtipos",
url: "https://clientes.guadaltel.es/desarrollo/geossigc/wfs?",
namespace: "mapea",
name: "centrosassda",
legend: "centrosassda",
geometry: 'POINT',
extract: true
});
points.on(M.evt.LOAD, function() {
points.getFeatures().forEach(function(point){
point.setAttribute('color', 'blue');
})
});
let plantillaStyle = new M.style.Point({
stroke: {
color: '{{color}}',
},
radius: 5
});
mapajs.addLayers(points);
mapajs.addPlugin(new M.plugin.AttributeTable());
function setCategoriaStyle(){
if (points == null ) return;
points.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.