I'm executing the code below to fetch the current position of the user. It works dandy but I'm only getting the "flat" information - altitude and longitude - while altitude is null. Can that be remedied and, if so, how?
var geolocationProvider = new Microsoft.Maps
.GeoLocationProvider(map).getCurrentPosition({
successCallback: function(data) {
var latitude = data.position.coords.latitude;
var longitude = data.position.coords.longitude;
var altitude = data.position.coords.altitude;
} ...
});
Please note that I'm looking for a solution based on JavaSCript calls (currently avoiding RESTing and WCFing). Might the issue be coming up because of:
a. problems with my code (bug or syntax getting data)
b. problems at the particular locations (spots with no data)
c. lack of altitude data on Bing Maps (no data at MS at all)
d. insufficient rights for my account (no data for my license)
e. wrong platform applied (no data for JS control approach)
f. other?
When I F12 the thing I see this.
data.position.coords
Coordinates {speed: null, heading: null, altitudeAccuracy: null, accuracy: 34, altitude: null…} accuracy: 34
altitude: null
altitudeAccuracy: null
heading: null
latitude: 59.333358800000006
longitude: 18.0567974
speed: null
__proto__: Coordinates
The altitude information would be returned if it's available. The location API that powers this uses several different methods to determine a users location; GPS, WIFI triangulation, IP address. Only the GPS method would be able to provide the users true altitude. Wifi triangulation could provide an approximate one but is generally not returned due to error.
If you want to get the elevation of the ground for where the user is then this could be retrieved from the Bing Maps Elevation service: http://msdn.microsoft.com/en-us/library/jj158959.aspx