[TEST] Style Plantilla + Layerswitcher
by SIGC GUADALTEL
HTML
<script src="https://sigc.desarrollo.guadaltel.es/mapea/js/mapea.ol.min.js"></script>
<link rel="stylesheet" href="https://sigc.desarrollo.guadaltel.es/mapea/assets/css/mapea.ol.min.css">
<script src="https://mapea4-sigc.juntadeandalucia.es/js/configuration.js"></script>
<button onclick=setStyle()>
setStyle plantilla
</button>
<div id="map"></div>
CSS
html,
body {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}
JavaScript
var mapajs = M.map({
'container': 'map',
"controls": ["layerswitcher"]
});
var centros = new M.layer.WFS({
url: "https://ws243.juntadeandalucia.es/geoserver/cips_oracle/wfs?style=cipscentros_sld", // Geoserver 2.11
namespace: "cips_oracle",
name: "SSV_CENT_CENTROS",
legend: "Recursos de Servicios Sociales",
geometry: 'POINT',
Projection: 25830,
extract: true,
});
mapajs.addLayers(centros);
centros.on(M.evt.LOAD, () =>{
centros.getFeatures().forEach(f => f.setAttribute('color', 'red'));
})
const setStyle = () => {
centros.setStyle(new M.style.Point({fill:{color:'{{color}}'}}))
}