CP-CHAP-12
TEST - filtro 2layers
by SIGC
HTML
<script src="https://sigc.desarrollo.guadaltel.es/mapea5/js/mapea.ol.min.js"></script>
<script src="https://sigc.desarrollo.guadaltel.es/mapea5/js/configuration.js"></script>
<link rel="stylesheet" href="https://sigc.desarrollo.guadaltel.es/mapea5/assets/css/mapea.ol.min.css">
<button id="btnFiltrar" onclick="setFiltro()">
Filtrar</button>
<button id="filtrar" onclick="limpiar();">
Limpiar filtro
</button>
<div id="map"></div>
CSS
html,
body {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}
JavaScript
let mapajs = M.map({
container: "map",
wmcfile: "callejero",
controls: ["layerswitcher"]
});
const lySevilla = new M.layer.WFS({
name: "Provincias",
url: "http://geostematicos-sigc.juntadeandalucia.es/geoserver/tematicos/wfs",
namespace: "tematicos",
cql: "nombre='Sevilla'"
});
lySevilla.on(M.evt.LOAD, function() {
lySevilla.setStyle(new M.style.Polygon({
stroke: {
color: 'yellow',
width: 3
}
}));
});
let lyComarcas = new M.layer.WFS({
name: "comarcas",
url: "http://geostematicos-sigc.juntadeandalucia.es/geoserver/tematicos/wfs",
namespace: "tematicos"
});
lyComarcas.setStyle(new M.style.Polygon({
stroke: {
color: 'white',
width: 3
},
fill:{
color: 'blue',
opacity: 0.3
}
}));
let f = new M.Feature("f", {
"type": "Feature",
"id": "f",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[186811.8571096273, 4071466.260144673],
[186811.8571096273, 4251380.3702658685],
[355698.63041960564, 4251380.3702658685],
[355698.63041960564, 4071466.260144673],
[186811.8571096273, 4071466.260144673]
]
]
},
"properties": {"nombre":"envelope"}
});
let f2 = new M.Feature("f2", {
"type": "Feature",
"id": "f",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[199811.8571096273, 4041466.260144673],
[199811.8571096273, 4221380.3702658685],
[358698.63041960564, 4221380.3702658685],
[358698.63041960564, 4041466.260144673],
[199811.8571096273, 4041466.260144673]
]
]
},
"properties": {"nombre":"envelope"}
});
let lyEnvelope = new M.layer.GeoJSON({
source: {
"crs": {
"properties": {
"name": "EPSG:25830"
},
"type": "name"
},
"features": [],
"type": "FeatureCollection"
},
name: 'prueba'
});
//NO TIENE SENTIDO ESPERAR AL LOAD DE UNA CAPA QUE NO HACE NINGUNA PETICIÓN
lyEnvelope.on(M.evt.LOAD, function() {
...