[Test] 5.1.0 KML label
by Francisco
HTML
<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/mapea-5.1.0.ol.min.js"></script>
<script src="https://mapea4-sigc.juntadeandalucia.es/js/configuration-5.1.0.js"></script>
<button onclick="javascript:addKML()">
addKML
</button>
<button onclick="javascript:removeKML()">
removeKML
</button>
<div id="map"></div>
CSS
html,
body {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}
JavaScript
mapajs = M.map({
container:"map",
controls: ["layerswitcher", "mouse"],
center: [320000,4170000],
zoom: 2,
wmcfile: ["callejero"],
//layers: ["KML*Arboleda*http://mapea4-sigc.juntadeandalucia.es/files/kml/arbda_sing_se.kml*true*false"]
});
mapajs.addKML(new M.layer.KML({
url: "http://mapea4-sigc.juntadeandalucia.es/files/kml/arbda_sing_se.kml",
name: "Arboleda",
//extract: true,
//label: true
}));
function addKML(){
//añadir la capa mediante objeto
mapajs.addKML(new M.layer.KML({
url: "http://mapea-sigc.juntadeandalucia.es/sepim_server/api/datos/kml/1193/item/341",
name: "capaKML",
extract: true
}));
}
function removeKML(){
capasKML = mapajs.removeKML({name: "capaKML"});
}