57
Views
2
Comments
[OpenstreetMapPlugin] Using map events
openstreetmapplugin
Reactive icon
Forge asset by Toto
Application Type
Reactive

Hi,

Needed to store the Lat/Long of the location the user clicks on, was a bit of a struggle to figure this out but proved to be rather simple to do.

1. in load.js add a listener that calls an outsystems action

function onMapClick(e) { $actions.ProcessMapClick(e.latlng.lat, e.latlng.lng, mapjs.getZoom())}

mapjs.on('click', onMapClick);

2. The ProcessMapClick action triggers an event MapClicked

3. In you application define an action to handle the event

OpenstreetMapPlugin.oml
UserImage.jpg
Ido Lelie

Also added a OnParametersChanged action to synchronize the view with updated info from the database. OnReady triggers before data is loaded.

OpenstreetMapPlugin.oml
UserImage.jpg
Ido Lelie

Added the Marker layer to OnParametersChanged

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