Skip to content

Instantly share code, notes, and snippets.

@dmethvin
Created September 26, 2011 14:43
Show Gist options
  • Save dmethvin/1242388 to your computer and use it in GitHub Desktop.
Save dmethvin/1242388 to your computer and use it in GitHub Desktop.
Windows 8 api sample geting lat/lon
(new Windows.Devices.Geolocation.Geolocator()).getGeopositionAsync().then(function(pos){
// If lat/lon not available, just use a default
pos = pos || { coordinate: { latitude: 39, longitude: 76, accuracy: 42 } };
$("#latlon").text(
"lat=" + pos.coordinate.latitude + ", lon=" + pos.coordinate.longitude +
", accuracy=" + pos.coordinate.accuracy+
", addr=" + (pos.civicAddress.city || pos.civicAddress.state || pos.civicAddress.postalCode)
);
// Get the weather associated with this lat/lon
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment