[Wiki] Mapea 4 - GeoJSON
by Francisco
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
var mapajs = M.map({
container:"map",
wmcfiles:["callejero"]
});
//GeoJSON servido
//mapajs.addLayers(new M.layer.GeoJSON({name: "Provincias", url: "http://geostematicos-sigc.juntadeandalucia.es/geoserver/tematicos/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tematicos:Provincias&maxFeatures=50&outputFormat=application/json"}));
//GeoJSON local
mapajs.addLayers(new M.layer.GeoJSON({
source: {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"LineString","coordinates":[[-7.542114257812498,38.09998264736481],[-6.481933593749999,37.53586597792038],[-5.872192382812499,37.97018468810549],[-4.526367187499999,37.82714141683739],[-5.44921875,36.97183825093164],[-4.542846679687499,37.21720611325499]]},"properties":{"id":"861f97ea-bf73-4686-b27f-38cfc94a3b98","options":{}}}]},
name: 'prueba'
}));