You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Show current location functionality with circle around the location #118
Hello,
What I am trying to achieve is a 'show current positon' fuction on bing maps with an accuracy circle drawn around it.
Steps:
1.Get the device current position from the web api which return the current latitude and logitude with the accuracy radious and bbox.
(Step one solution is simply to use window.navigator.geolocation functioins)
2.Draw a polygon (circle) around the the position as big as the the radious in meters.
(How to calculate the points required? )
3.A button over the map which sets the map around the current bbox.
My idea for the implementatioin is to get the boundsChange event from the map to query data for the markers based on bbox.(the base for every live map app) My problem is that the box property of the map does not get updated when the boundsChange event fires so it is not possible to set the map screen back more than once since the box property stays the same even tho the map screen is at another location. (I tryed to set it to null and undefined it does not seemd to work)
Any suggestions for this?
This question maybe would better fit for stackoverflow, tho I thought that it is some basic functionality for live maps using device positions, so I thought it could benefit others as well.
changed the title [-]Draw circle around around current location with added padding[/-][+]Draw circle around around current location [/+]on Oct 30, 2019
changed the title [-]Draw circle around around current location [/-][+]Show current location functionality with circle around the location[/+]on Oct 30, 2019
obtain current location: yes i'd say use the geolocation function. now, there might be some trickiness with AOT, since this is a browser function and therefore not available outside the browser. Just be aware of that.
circle support (which is on the list of things to do, there is a project for that). For the time being, you can simply calculate a polygon with 720 points (one for each half rad), that should be sufficiently smooth. Simple trigonometry, keep the radius constant, advance the angle, that gives you the lat/long offsets for each point. There is probably an algorithm out there on stackoverflow I'd think.
I don't quite understand your point under 3 though. the [Box] property is an input, so yes, it does not get changed as the map zooms. However, the (BoundsChange) event gives you the new box whenever the zoom changes or the bounds change. So you can use that to update your box variable
Activity
[-]Draw circle around around current location with added padding[/-][+]Draw circle around around current location [/+][-]Draw circle around around current location [/-][+]Show current location functionality with circle around the location[/+]thor-schueler commentedon Nov 1, 2019
There are a few things here:
I don't quite understand your point under 3 though. the
[Box]property is an input, so yes, it does not get changed as the map zooms. However, the(BoundsChange)event gives you the new box whenever the zoom changes or the bounds change. So you can use that to update your box variable