[Google Maps] add / delete marker from dynamic

Forge Component
(43)
Published on 2019-08-06 by Labs
43 votes
Published on 2019-08-06 by Labs

I am looking for an event which helps me to, add and delete the marker dynamically based on database entries

I am able to place multiple markers using MapInit event, didn't find an event for runtime adding and deleting the markers.

You can call the AddMarkerToBounds and RemoveMarkerFromMap actions at any time just passing it the mappid. Having it auto launch whenever a new record is added to an entity is a bit harder, you can use BPT to create an event on the entity but this won't be running in the screen context so you need some other way to trigger the screen update. The simplest is to use a javascript timer and read new/changed entries from the entity. There is an old forge component I created a that you can use to create a timer and trigger an action https://www.outsystems.com/forge/component-versions/2186 that can help. Written for O10 but should still work on in O11.

Hey John,

Thanks for the reply

I will implement this and update you



Cool. Let me know if you need any help. I've just done up a simple addon component to the google maps to extend it so that we can move a pin instead of removing it and re adding if thats helpful 

Could you please share the forge link for the same?

Not on the forge yet but I'll put something up in this thread in the morning when i get into work

Processing Upload...

Here you go try this attached component. To use simply place the ExtendGoogleMaps webblock on the same screen and below the google maps component itself and then call the MoveMarker action in your code passing in the Google Mapp's component ID, the MapMarker ID used when doing the original AddMarker and the new position

upload is still in process :

Hmm. Will try again.

Ok that's worked now

John Williams wrote:

Ok that's worked now

Thanks, it worked for me as well

I have modified it to move multiple markers smoothly.