Answered by:
BING MAPs V8 and Microsoft.Maps.GeoLocationProvider

Question
-
Hello All
I am trying to convert some JavaScript code that I inherited that is used for BING Maps V7 and convert it to an equivalate BING Maps V8 syntax.
The issue is that in BING Maps V8 “Microsoft.Maps.GeoLocationProvider” is no longer used.
In the following code sniplet get’s built up and passed to the “Microsoft.Maps.GeoLocationProvider”_map = new Microsoft.Maps.Map(element,
{
credentials: bingCredentials,
mapTypeId: Microsoft.Maps.MapTypeId.road,
width: _width,
height: _height,
center: new Microsoft.Maps.Location(49.6097, -125.3331),
zoom: _zoom,
showDashboard: true,
showMapTypeSelector: true,
enableClickableLogo: false,
enableSearchLogo: false,
fixedMap"color:blue;font-family:Consolas;font-size:9.5pt;">true
});
This is the “Microsoft.Maps.GeoLocationProvider” which is no longer supported in BING maps V8
_geoLocationProvider = new Microsoft.Maps.GeoLocationProvider(_map);
Both of these code segments are contained in a larger JavaScript function.
I think what is used instead of “Microsoft.Maps.GeoLocationProvider” is HTML5 Geoloaction API navigator.geolocation.getCurrentPosition();
I am not sure how to build up the _map variable to pass to navigator.geolocation.getCurrentPosition();
My knowledge of using BING maps is very limited.Thursday, November 2, 2017 7:30 PM
Answers
-
This feature was removed in v8 as there is no need for it anymore as all major browsers now support the geolocation API out of the box. When v7 was created ie6 was still a major browser and didn't have any geolocation feature, so bing maps v7 added a workaround for this. See the v7 to v8 migration guide here https://social.technet.microsoft.com/wiki/contents/articles/34563.bing-maps-v7-to-v8-migration-guide.aspx
- Proposed as answer by Ricky_Brundritt Friday, November 3, 2017 4:27 AM
- Edited by Ricky_Brundritt Friday, November 3, 2017 4:28 AM
- Marked as answer by Ricky_Brundritt Monday, November 13, 2017 11:34 PM
Friday, November 3, 2017 4:27 AM
All replies
-
This feature was removed in v8 as there is no need for it anymore as all major browsers now support the geolocation API out of the box. When v7 was created ie6 was still a major browser and didn't have any geolocation feature, so bing maps v7 added a workaround for this. See the v7 to v8 migration guide here https://social.technet.microsoft.com/wiki/contents/articles/34563.bing-maps-v7-to-v8-migration-guide.aspx
- Proposed as answer by Ricky_Brundritt Friday, November 3, 2017 4:27 AM
- Edited by Ricky_Brundritt Friday, November 3, 2017 4:28 AM
- Marked as answer by Ricky_Brundritt Monday, November 13, 2017 11:34 PM
Friday, November 3, 2017 4:27 AM -
Thanks Ricky for the information!Monday, November 13, 2017 9:56 PM