Created
November 8, 2013 19:51
-
-
Save joeyoun9/7376603 to your computer and use it in GitHub Desktop.
Super-basic map/metadata station location request and plot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: '© <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