[Demo] json to GeoJSON 2
by Francisco
HTML
<script src="https://mapea4-sigc.juntadeandalucia.es/js/mapea-5.1.0.ol.min.js"></script>
<script src="http://mapea4-sigc.juntadeandalucia.es/js/configuration-5.1.0.js"></script>
<link rel="stylesheet" href="https://mapea4-sigc.juntadeandalucia.es/assets/css/mapea-5.1.0.ol.min.css">
<div id="map"></div>
CSS
html,
body,
#map {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
JavaScript
var mapajs = M.map({
container: "map",
controls: ["layerswitcher", "mouse"],
wmcfiles: ["mapa"]
});
// Añadimos la capa
let oficinas = new M.layer.GeoJSON({
name: "Oficinas",
crs: "EPSG::25830",
source:
});
mapajs.addLayers([oficinas]);
let f1 = new M.Feature(1, {
properties: {
nombre: 'Feature-1'
},
type: "Feature",
id: 1,
geometry_name: "geometry",
geometry: {
type: "Point",
coordinates: [284469, 4142704]
}
});
let f2 = new M.Feature(2, {
properties: {
nombre: 'Feature-2'
},
type: "Feature",
id: 2,
geometry_name: "geometry",
geometry: {
type: "Point",
coordinates: [303597, 4159135]
}
})
oficinas.addFeatures([f1, f2]);
// Añadimos features cuando la capa esté en el mapa
//oficinas.on(M.evt.LOAD, () => {
//})