tupali_fork/mjson.php
2017-04-26 20:11:59 -05:00

31 lines
1.1 KiB
PHP

<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="librerias/leaflet/leaflet-providers.js"></script>
</head>
<body>
<div id="map" style="width: 100%; height: 300px;"></div>
<script type="text/javascript">
var map = L.map('map');
var terrainTiles = L.tileLayer.provider('OpenStreetMap.Mapnik');
terrainTiles.addTo(map);
map.setView([4, -72], 3);
function addDataToMap(data, map) {
var dataLayer = L.geoJson(data, {
onEachFeature: function(feature, layer) {
var popupText = "Titulo: " + feature.properties.name
+ "<br>Location: " + feature.properties.coordinates
+ "<br><a href='" + feature.properties.title + "'>More info</a>";
layer.bindPopup(popupText); }
});
dataLayer.addTo(map);
}
$.getJSON("https://www.kleper.net/wiki/lib/exe/fetch.php/ruta_paz_territorial.geojson", function(data) { addDataToMap(data, map); });
</script>
</body>
</html>