Services Plugins FAQs

MapBox: Speed not working

Hi

I can’t get map speed variable to work. Hejst to do?

1 Like

Hi @siticum ,

To streamline our communication, please let’s consolidate our conversation into a single thread, since all your queries pertain to the Mapbox Maps plugin. For now, I will respond to each thread individually, but moving forward, please reply in just one thread of your choosing. Thank you for your cooperation. :pray:

Regarding the “Speed” state, I’ve also noticed this problem and it seems it may have been overlooked in the plugin code before. Could you let us know how you intended to use this state, so we can further explore the possibility of including such feature in a future update.

Thanks again,

Best,
Stefan

Okay. Its very much needed. I know that your recently acquired Leafy Map have it working and working well. That plugin cant do for us all all though.

We need the Speed variable to adjust both the map zoom level, once the user is in “full auto navigation mode” and to adjust the distance at which our app finds and plays stories. Eg. waling will only play stories in the near vicinity (100 m), while traveling by car, will play stories further away (2 km).

The latter is crucial to the app.

We will need it several places in APIs defining minimum and maximum distance to POIs, both on the map, and off the map.

As you suggested, I will add new bugs in this thread to keep them collected.

We would like to add makers as clusters to avoid excessive memory usage. However the workflow action is missing both marker SIZE and marker ANCHOR. The add list of markers has these two settings added.

Adding this will also be a big thing for us. Having 100+ markers crashes the app. It doesn’t happen using clustering.

See screenshot without the anchoring and size setting:

Hi @siticum,

Thank you so much for your appreciation of Leafy Maps. We’re currently working on further improvements as well.

From your first message, it seems you need the route distance you’ll be traveling. You can easily obtain this from the Mapbox states or the “Get route data” API call. However, it’s not entirely clear what specific speed information you’re looking for. Please clarify, so we can check the Mapbox documentation to determine if it’s possible to add.

Regarding the Cluster Markers, they can indeed be very helpful for displaying a large number of markers more compactly. We’ve recently added several improvements to the cluster functionality, allowing more settings to be adjusted. For Cluster size and anchor, the size in this action will always be 1:1 due to library constraints. Therefore, you should predefine the image sizes in the database to ensure they display correctly on the map. Concerning the anchor, I’ve forwarded this to our development team for review and potential addition.

I hope this clarifies everything. If you have any other questions, please let me know.

Thanks, and I look forward to your reply.

Best regards,
Stefan

Thanks for your quick reply and info.

CURRENT USER SPEED: We need the current speed at which the user is traveling. I am currently displaying it from the MapBox state “Speed” but it is not working as you mention. LeafyMap has a similar state which does. It does not relate to route data. If MapBox cant provide the user speed, its might be possible to add this to the plugin using another API?

CLUSTERING MARKER SIZE: Argh. That’s too bad as it will make them pixelated and not suitable for our use. Is there anything else you can to? - Considering it can be done in lists and single markers, it seem vary strange that it cant be done in clusters. Fixing this, will also fix memory crash issues for others developers than me.

Looking at: Display HTML clusters with custom properties | Mapbox GL JS | Mapbox it seems that the HTML markers inherit their properties when using the clustering property. Not an expert in the library myself.

Thanks for forwarding the anchor addition.

PHONE TILT DATA: “Regarding your request about the phone tilt feature, could you please confim if you are talking about this feature which is present …”

Yes - I confirm. BUT it is the phone’s tilt value. The map pitch feature is already in MapBox.

NEW: SET NEW MARKER ICON: We would like to be able to replace a marker icon, or rather display another once a marker is pressed in our native app. Instead of adding “remove marker” and “add marker” which is cumbersome and slow, it will be great with a WHEN MAKER IS CLICKED trigger, and a REPLACE MARKER ICON action.

1 Like

Hello @siticum,

Thank you for your message and for providing detailed explanations.

We have addressed each of your concerns and will provide specific answers for each:

Regarding the current user speed, I have noted your request and forwarded it to our development team for further examination and resolution.

Concerning the cluster marker size, cluster markers function differently from simple markers. We have recently introduced the possibility to use images instead of points. However, these will be displayed on the map at the same size they are in the database. You can use a third-party tool to resize the icons to your desired display size. Additionally, in the “Add list of markers” action, images for the markers are loaded at full size and then resized using CSS, meaning the size there doesn’t have any impact on memory usage.

Regarding the phone tilt and anchor, these issues are currently under review by our developers, and we will inform you as soon as there are any updates.

As for your questions about “SET NEW MARKER ICON”, there is an event called “Cluster Marker Clicked” that you can use in your workflow when you click on a cluster marker. Regarding setting marker icon, we have previously explored this, but it functions differently in Mapbox compared to other elements in Bubble that are directly connected to the database. Changes in Mapbox require updates in the database, followed by removing and re-adding clusters. These actions run quite swiftly even with a large number of clusters present, without causing too much visual problems on the map. You can view this working in this Loom video [link].

I hope this clarifies your concerns. Please let me know if you have any further questions or need additional assistance.

Thanks, and have a great day ahead!

Best regards,
Stefan

USER SPEED: Fantastic. Thanks

CLUSTER MARKER SIZE: Good to know regarding memory usage.

If the markers are resized on the Add list of markes… action using CSS, why not add that resizing setting to the clustering as well? I can’t be the only one that need this and it could be considered a design flaw.

SET NEW MARKER ICON: Okay. Will do for us. The approx. 50-100 ms delay can be handled by adding the new marker(s) on top of the old, then removing the old marker(s). Apricate the info.

MAP HEADING AND MAP HEADING CHARACTER: From the other thread, I have further tested getting data from the MapBox heading and heading character states. I had it working once last week using the compass plugin using the Request orientation, then Resume orientation. But cant get it to work anymore.

Its still says Heading supported = No. We will need this in the app, and its seems to be a permission bug of some sorts. Also, a dedicated Request orientation action would be great.

See the video, where the marker heading is working, but the state is not populated: iCloud Photos - Apple iCloud

Best regards,
Sejr

Hello @siticum ,

Thank you for your message and all the observations observations.

Regarding the cluster marker size, I will forward this to the development team for them to explore again the possibility of incorporating it. I will share feedback as soon as it becomes available.

Regarding the map heading and heading characters, after further testing, it indeed appears there are some issues specific to iOS devices related to the requesting orientation. Using the steps you provided with the Compass plugin, I also managed to make it work after a refresh. This has also been forwarded to the dev team to identify the cause, and a dedicated Request orientation action will be considered for this case.

Thank you again for your valuable input. If there is anything else you need help with, please let me know.

Thanks and have a great weekend ahead!

Best regards,
Stefan

Thanks so much @Stephan! Really appreciated. Each bug fix and improvement makes our app better, and more fun to work on.

Enjoy the weekend once you are off work!

Cheers

One final requests, before the weekend on my end.

STATE WITH LIST OF ADDED MARKER IDs:

Having a state on the MapBox element with a list of markers ids on the map, enables us to keep tack off, and check against which makers is added. This makes removing and adding new markers much easier. The Google Maps Extended (not Zerocode’s version) plugin has this, which we at the time found very handy.

GET CLICKED CLUSTER MARKER LAT + LON:
Having 2 states on the MapBox element with cluster marker lat and lon, makes it tremendously easier for us to show details for each marker and save a couple of API calls.

SETTING CLUSTER FONT COLOR:
We would like to use dark colors for the cluster circles with awhite font color. Current the font color is fixed to black. Any chance you can add a field for thefont color selction?

Testing further with clusters and lots of markers, fixes out big headache. The app does not crash anymore :slight_smile: - Would really like to get it working well.

Cheers