[Test] add- KML

by SIGC

HTML

<script src="http://mapea4-sigc.juntadeandalucia.es/js/mapea.ol.min.js"></script>
<link rel="stylesheet" href="http://mapea4-sigc.juntadeandalucia.es/assets/css/mapea.ol.min.css">
<script src="http://mapea4-sigc.juntadeandalucia.es/js/configuration.js"></script>
<div id="map">
</div>

CSS

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

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"]
     });


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


          capaKML.on(M.evt.LOAD, function(layer) {
          console.log(layer)
       mapajs.setBbox(layer.getFeaturesExtent());
     })
     //añadir la capa mediante objeto
     mapajs.addKML(capaKML);