[Test] features bbox
by Francisco
HTML
<script src="https://mapea4-sigc.juntadeandalucia.es/js/mapea-5.1.0.ol.min.js"></script>
<link rel="stylesheet" href="https://mapea4-sigc.juntadeandalucia.es/assets/css/mapea-5.1.0.ol.min.css">
<script src="https://mapea4-sigc.juntadeandalucia.es/js/configuration-5.1.0.js"></script>
<div id="map"></div>
CSS
html,
body,
#map {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
JavaScript
let misFeatures = [
new M.Feature("featurePrueba001", {
"type": "Feature",
"id": "prueba_pol_wfst.1985",
"geometry": {
"type": "Point",
"coordinates": [-5.278075, 37.69374444444444]
},
"geometry_name": "geometry",
"properties": {
"nombre": "feature1"
}
}),
new M.Feature("featurePrueba002", {
"type": "Feature",
"id": "prueba_pol_wfst.1985",
"geometry": {
"type": "Point",
"coordinates": [-5.347761111111111, 37.84215833333334]
},
"geometry_name": "geometry",
"properties": {
"nombre": "feature2"
}
}),
new M.Feature("featurePrueba003", {
"type": "Feature",
"id": "prueba_pol_wfst.1985",
"geometry": {
"type": "Point",
"coordinates": [-4.629191666666667, 37.95544166666667]
},
"geometry_name": "geometry",
"properties": {
"nombre": "feature3"
}
}),
new M.Feature("featurePrueba004", {
"type": "Feature",
"id": "prueba_pol_wfst.1985",
"geometry": {
"type": "Point",
"coordinates": [-3.718202777777778, 37.39816111111111]
},
"geometry_name": "geometry",
"properties": {
"nombre": "feature4"
}
})
];
console.log('Número de features:' + misFeatures.length);
console.log('Bbox: ' + M.impl.utils.getFeaturesExtent(misFeatures, "EPSG:4326"));
var mapajs = M.map({
container: "map",
layers: ["OSM"],
projection: "EPSG:4326*d",
controls: ["mouse"],
bbox: M.impl.utils.getFeaturesExtent(misFeatures, "EPSG:4326")
});