Skip to content

Instantly share code, notes, and snippets.

@joeyoun9
Created November 8, 2013 19:51
Show Gist options
  • Save joeyoun9/7376603 to your computer and use it in GitHub Desktop.
Save joeyoun9/7376603 to your computer and use it in GitHub Desktop.
Super-basic map/metadata station location request and plot
map = L.map('mapdiv',{minZoom:8}).setView([40.6,-111.5], 10);
// add an OpenStreetMap tile layer
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// add a circle demonstrating where we are looking
L.circle([40.5, -111.5], 32187, {
color: 'green',
fillColor: 'green',
fillOpacity: 0.1
}).addTo(map);
// request all the stations at the center of this map for 20 miles?
$.getJSON('http://api.mesowest.net/stations?callback=?',
{
// specify the request parameters here
status:'active',
radius:'40.5,-111.5,20',
token:tkn
}, function (data) {
stns = data.STATION
for (stn in stns)
{
s=stns[stn];
L.marker([s.LATITUDE, s.LONGITUDE],{title:s.NAME}).addTo(map);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment