I'm learning to create windows 8 apps and I'm stumped as regards something.
Say I am in London. And I want to find Trafalgar square relative to where I am standing. But based on a compass. So for example if I am south of trafalgar, regardless of how far away, the compass would point north.
How on earth do I get access to the tablet's location to then calculate where it is, relative to that location?
Here is the link for the geolocation sample in Windows 8: Windows 8 Geolocation Sample
You can check the samples in C#, JavaScript, and C++. Below is the specific part where it shows the latitude and longitude in JavaScript. You can find the corresponding in C++/C# by browsing through the code samples:
JavaScript
function getPositionHandler(pos) {
document.getElementById('latitude').innerHTML = pos.coordinate.latitude;
document.getElementById('longitude').innerHTML = pos.coordinate.longitude;
document.getElementById('accuracy').innerHTML = pos.coordinate.accuracy;
document.getElementById('geolocatorStatus').innerHTML =
getStatusString(loc.locationStatus);
}
Regarding location of Trafalgar Square, I'm sure Bing Maps API or Google Maps API, or any Maps API will help in finding the specific longitude and latitude.
I also suggest you take a look at this StackOverflow post regarding longi/latitude: Link
I also have given a link for a code snippet to find lat/long using Google Maps API: Link
To parse the direction, you might have to write your own function, which shouldn't be too difficult.
Hope this helps in your app development!
Edit: I have also attached two links for determining distance and bearing with two latitudes. They are both pretty much the same: Link 1, Link 2. They explain the concepts very well.
Second Edit: Did you catch your pun? >> How on earth do I get access to the tablet's location to then calculate where it is, relative to that location?