[Wiki] Mapea4 - KML

by Francisco

HTML

<link rel="stylesheet" href="https://mapea4-sigc.juntadeandalucia.es/assets/css/mapea-5.0.0.ol.min.css">
<script src="https://mapea4-sigc.juntadeandalucia.es/js/mapea-5.0.0.ol.min.js"></script>
<script src="http://mapea4-sigc.juntadeandalucia.es/js/configuration-5.0.0.js"></script>
<button onclick="javascript:addKML()">
addKML
</button>
<button onclick="javascript:removeKML()">
removeKML
</button>
<div id="map"></div>

CSS

html,
body,
#map {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
}

JavaScript

// capa KML pasada en el constructor
/*mapajs = M.map({
				container:"map",
         controls: ["layerswitcher"],
         center: [548830,4077720],
        zoom: 8,
        layers: ["KML*capaKML*http://mapea-sigc.juntadeandalucia.es/sepim_server/api/datos/kml/1194/item/469*true"]
			});
*/

let kml = new M.layer.KML({
  url: "http://mapea4-sigc.juntadeandalucia.es/files/kml/arbda_sing_se.kml",
  name: "capaKML",
  extract: true
}, {},{
  showPointNames: false
});

mapajs = M.map({
  container: "map",
  controls: ["layerswitcher", "mouse"],
  center: [320000, 4170000],
  zoom: 2,
  wmcfile: ["callejero"],
  layers: [kml]
});