Created
September 26, 2011 14:43
-
-
Save dmethvin/1242388 to your computer and use it in GitHub Desktop.
Windows 8 api sample geting lat/lon
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
(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