185
Views
10
Comments
[Google Maps Web] add / delete marker from dynamic
Question
google-maps-web
Web icon
Forge asset 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.

2021-04-21 23-06-46
Jeanene Williams

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.

UserImage.jpg
Dipesh Malani

Hey John,

Thanks for the reply

I will implement this and update you



2021-04-21 23-06-46
Jeanene Williams

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 

UserImage.jpg
Dipesh Malani

Could you please share the forge link for the same?

2021-04-21 23-06-46
Jeanene Williams

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

2021-04-21 23-06-46
Jeanene Williams

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

ExtendedGoogleMaps.oml
UserImage.jpg
Dipesh Malani

upload is still in process :

2021-04-21 23-06-46
Jeanene Williams

Hmm. Will try again.

ExtendedGoogleMaps.oml
2021-04-21 23-06-46
Jeanene Williams

Ok that's worked now

UserImage.jpg
Dipesh Malani

John Williams wrote:

Ok that's worked now

Thanks, it worked for me as well

I have modified it to move multiple markers smoothly.  


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