Cuando se hace una consulta a esta URL –> https://wanderdrone.appspot.com/
Se devuelve un GeoJSON:
{"geometry": {"type": "Point", "coordinates": [-80.318956205249776, 21.32829010710741]}, "type": "Feature", "properties": {}}
{
"geometry":{
"type":"Point",
"coordinates":[
-80.318956205249776,
21.32829010710741
]
},
"type":"Feature",
"properties":{
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>GeoJSON from live realtime data</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.1.9/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.9/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id='map'></div>
<script>
L.mapbox.accessToken = 'pk.eyJ1IjoiYWFpemVtYmVyZyIsImEiOiJIQmdlUkVzIn0.kzKfi1ndNMUcY4sH07RaUQ';
var map = L.mapbox.map('map', 'mapbox.streets')
.setView([38, -102.0], 2);
// As with any other AJAX request, this technique is subject to the Same Origin Policy:
// //en.wikipedia.org/wiki/Same_origin_policy
var featureLayer = L.mapbox.featureLayer()
.loadURL('https://wanderdrone.appspot.com/')
// Once this layer loads, we set a timer to load it again in a few seconds.
.on('ready', run)
.addTo(map);
function run() {
featureLayer.eachLayer(function(l) {
map.panTo(l.getLatLng());
});
window.setTimeout(function() {
featureLayer.loadURL('https://wanderdrone.appspot.com/');
}, 2000);
}
</script>
</body>
</html>