Hi Zeroqode!
One for you @levon
So, I wanted to ask if we could have some additions put into the MapBox plugin. I’ve been testing it recently and hope to eventually use for a new app. I’m also hoping that you guys can put some of these in. Most of them are relatively simple, a couple may be a little more awkward and they’re based around supporting the routing aspect of it.
Tracking
Can we have some options added that come with the ‘Start Location Tracking’ action as referenced here…
https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions
enableHighAccuracy,
timeout,
maximumAge,
custom: auto rotate map to keep route facing ahead.
This would be super useful, maybe just set the map bearing with the heading value every time the location was found. I could do it myself if the next section was implemented although better to have this in the plugin so no delays.
When tracking, is there an option to follow on the map so the map moves as you do?
https://docs.mapbox.com/mapbox-gl-js/api/#geolocatecontrol
Events
“Location found” and “Location not found” events.
Can we have a couple of new events that only get triggered when the ‘Start Location Tracking’ event has been run. They shouldn’t be triggered when the location is not being tracked.
https://docs.mapbox.com/mapbox-gl-js/api/#geolocatecontrol.event:geolocate
Would you be able to create an action called “Set event listener” and have a dropdown inside it with all the different events that can be set on a map? I’ve not checked which ones are available but I assume there are some. When an event is fired, for example ‘moveend’ (if that one exists) then a bubble event is triggered - 'Map event is fired" or something. We can then run workflows on different things like if a user double taps, move/drag has ended, zoom is changed etc…
I’m thinking you’d need to be careful as to not allow for the action to create multiple events of the same type on a map here, because a bubble event may trigger 5 times if you tried to set the same type of event 5 times in your workflow (not that people would do that of course! state it in the documentation part). You may want to not allow duplicate events to be set but you certainly don’t want to remove any that are there by default which may prohibit normal operation of the map.
Clearing a route
The ‘Set directions’ action creates a nice route on the map, but how do you clear it?
Heading
This is bugging me! Exposed states ‘Heading supported’ and ‘GPS enabled’ are both showing no through iPhone (yes through Chrome), which seems a little strange to me. As a result, I can’t get the heading degrees value. There must be a way to make these available, they’re only useful on your phone, how to make those yes!
Multiple waypoints
Ability to add multiple waypoints to a route using the ‘Set directions’ action. Can we make this action work with not only a start and end point, but also multiple points along a route? It might be a better option to have a new action called “Add to route” perhaps? or some other method like allowing lists in the Origin and Destination field, then it would simply be up to the user to manipulate the address lists into the correct order in which they want the points to be plotted on a map.
Routing Profile
Can we set the following as options in the ‘Set directions’ action? The correct route would then be displayed based on the option selected.
driving-traffic,
driving,
walking,
cycling.
https://docs.mapbox.com/help/glossary/routing-profile/
Navigation controls
Can we add all of these?
showCompass,
showZoom,
visualizePitch.
https://docs.mapbox.com/mapbox-gl-js/api/#navigationcontrol
Exposed state
Can you add a ‘Current speed’ state. Value could be whatever the default is, like in meters per second or you could add one for KPH and another for MPH. Calculations for each based on meters per second are below.
KPH = meters per sec * 3.6
MPH = meters per sec * 2.237
Map center exposed states (lat/lng) are not updated when the map moves, instead they only get updated when you click the map once, they should ideally be updated after a map move has ended otherwise you can keep on moving the map around and the cords never get updated unless you finish with a tap/click.
Route options!
This is a big one for me but crucial none-the-less and I can’t do what I want without it.
So, there’s a lot of data when it comes to planning a route, just think of “sat-nav” and return everything you can think of to make a typical sat-nav app work. I don’t know if you’re using the Directions API at any point, but if you are and all the data is available in it, then adding it to the ‘Get data from an external API’ would be great.
- Directions (instructions) when route is planned, get all the route info back.
- Route leg options & step manoeuvres object & voice instructions object.
- Recalculate a route when ‘tolerance’ (which you can set) is past a specified threshold.
Tolerance being a value which detects by how much you’re ‘off-route’ by and recalculates accordingly.
Bug - (no longer happening after retesting, kept in here for reference)
It looks like bubble’s star rating plugin is interfering with this, not done much testing but just add the star rating element, open up the console and click on it.
I got an error saying “Cannot read property ‘pageX’ of undefined at r.getPosition”
Does this work with the WRLD 3D (or EeGeo) maps?
This would be the icing on the cake if it does!
And are we using map caching options?
Thanks for listening! great plugin and this one has so much potential. One map to rule them all
Keep us updated, Paul