//Hold markers group
var mesoMarkersGroup=new L.LayerGroup();
//Get weather information from Mesowest for the state VA
$.getJSON('http://api.mesowest.net/stations?callback=?',
{
state:'va',
latestobs:1,
token:'demoToken'
},
function (data)
{ //Loop through all the weather stations
for(var i=0;i<data.STATION.length;i++)
{
try{
var stn = data.STATION[i];
var dat = stn.OBSERVATIONS;
var stnInfo =stn.NAME.toUpperCase();
var elev=parseInt(stn.ELEVATION);
stnInfo = "<b>Air Temp: </b>"+Math.round(dat.air_temp[1])+"°F"+ "</br><b>Wind Speed: </b>"+Math.round(dat.wind_speed[1]* 1.150)+"MPH"+"</br>
+<b>Wind Direction: </b>"+getCardinalDirection(Math.round(dat.wind_direction[1]))+"</br><b>Relative Humidity: </b>"+dat.relative_humidity[1]+"%"+"</br>
+<b>Elevation: </b>"+elev+"′";
//Add stations into Leaflet markers group
L.marker(L.latLng(stn.LATITUDE,stn.LONGITUDE),{title:stn.NAME.toUpperCase()}).bindPopup(stnInfo).addTo(mesoMarkersGroup);
}
catch(e)
{
alert("Error! "+ e);
}
}
})
.done(function()
{
})
.fail(function()
{
alert("Could not access the MesoWest!");
});
//Add markers group to the Map
map.addLayer(mesoMarkersGroup);
Thursday, September 18, 2014
How to display the MesoWest weather stations in Leaflet.js?
Snippet to display MesoWest weather stations in Leaflet.
Where are my streets Chrome? Google Maps bug on Chrome or vice-versa
I was checking the route for nearest police station from my office around 3 PM MT using the Chrome. The Google Map's street looks so funny and floppy. All the street lines and highways lines were wiped out. The interstate has some brown points, if you zoom in them the point looks like half circle. Which has the bug Google Maps or Chrome? Click on images for bigger picture !
(Missing roads on zoom)
(More zoom in...)
(Missing roads)
(More zoom in...)
(Looks good in the Firefox though)
Wednesday, September 17, 2014
The Manager's Guide to PostGIS - Paul Ramsey at FOOSS4G 2014 PDX
Subscribe to:
Posts
(
Atom
)