[Google Maps Library] Markers Refreshing on Map with Parameter changes
Forge component by Labs
Application Type
Reactive

I am working on a Mobile application, that is utilizing this Google Maps Mobile Library to display a number of markers (held in a MapMarker list object). 

We are experiencing an issue, where updating local parameters on the page, will cause the markers of the map to "refresh" (ie: briefly disappear en-masse, and reappear a moment later). The parameters being updated do not have to have any relation to the map, or the list of MapMarkers. It just seems that anytime we update a parameter, all the markers flash like this.

This becomes an issue, as we also have a PositionWatch that returns an updated position value, as the user moves around. We want to record the position as it updates as a local parameter (so the last position on the map can be preserved, and returned to the next time we return to the page), and the position can change frequently. When it updates too frequently, it causes the markers to "flash" every other second. It can get to a point, where it is near impossible to tap on a marker, as they disappear and reappear.

In this scenario (video below), I just have a single test parameter (testInt, an Integer) that I am just updating by 1 every time the position updates. Triggering this update of the parameter refreshes all the markers, as shown below.


Whilst I have found a work-around for this problem and resolved my immediate problem (I'm not using local parameters to save this data; instead, I am deriving it from elsewhere when I need to save the data to the server), I am curious as to whether anyone else has experienced this issue.

I have also tried to replicate the issue, in a stand-alone application (stripping the case to the bare essentials)and it appears there as well. I am trying to build up an OML that could be used as an example file.

Solution

Yes, this is a limitation of the component itself.  I have had a similar experience where I have hundreds of markers, one of which is the user location.  You can imagine the detrimental user experience of hundreds of markers flashing every few seconds.


The reason this is happening is that when the onparameterschanged fires, the list of markers is wiped and recreated. I think the developers just probably figured that was a much simpler way to deal with a change than trying to look one by one. However, I have customized the component so that now it checks each individual marker to see if a change has been made.  If the markers are the same, it ignores them. If they have changed (which most of the time, none of them have except the gps marker), then it deletes and recreates them. This has solved the issue 100% for us. I would be happy to share my code with you so you don't have to reinvent the wheel on this one. Feel free to reach out to me privately if you are interested.


If the developers are watching this thread, this would be a great feature improvement, so that I don't have to save my changes and re-customize the component each time I update from the forge. Thank you!


Solution

Here is the oml.  Feel free to adjust it as you wish. It assumes that the GPS marker is in position #1.  Let me know if it works for your needs, of if we need to adjust it. I would love to submit it to Outsystems Labs as well for them to implement it, so long as it is general enough to suit the needs of all users.

GoogleMapsMobileNoFlash.oml

Solution

Yes, this is a limitation of the component itself.  I have had a similar experience where I have hundreds of markers, one of which is the user location.  You can imagine the detrimental user experience of hundreds of markers flashing every few seconds.


The reason this is happening is that when the onparameterschanged fires, the list of markers is wiped and recreated. I think the developers just probably figured that was a much simpler way to deal with a change than trying to look one by one. However, I have customized the component so that now it checks each individual marker to see if a change has been made.  If the markers are the same, it ignores them. If they have changed (which most of the time, none of them have except the gps marker), then it deletes and recreates them. This has solved the issue 100% for us. I would be happy to share my code with you so you don't have to reinvent the wheel on this one. Feel free to reach out to me privately if you are interested.


If the developers are watching this thread, this would be a great feature improvement, so that I don't have to save my changes and re-customize the component each time I update from the forge. Thank you!


Solution

Here is the oml.  Feel free to adjust it as you wish. It assumes that the GPS marker is in position #1.  Let me know if it works for your needs, of if we need to adjust it. I would love to submit it to Outsystems Labs as well for them to implement it, so long as it is general enough to suit the needs of all users.

GoogleMapsMobileNoFlash.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.