28
Views
4
Comments
Dynamic usage of OutSystems Maps
Question

In our application, we are using the OutSystems Maps component. However, its current implementation does not fully meet our requirements, and modifying the library also proved insufficient, as well as not being future proof.

 

Our Use Case:

Our application allows customers to draw an arbitrary number of markers and shapes (polygon and polylines) on a map, save these to a database, and later retrieve, edit, or delete them. After reopening the shapes at a later stage, users should also be able to modify or delete them again.

 

The Challenge:

  1. Shape Deletion: While the component works well for     drawing markers and shapes, it lacks a public "delete/remove"     function for shapes (only available for markers).
  2. Dynamic Identification: Since shapes are drawn dynamically based on a list, we     cannot reference the WidgetIds of these shapes during runtime, making it     impossible to manage them.
  3. Shape Editing: When users edit shapes, the updated coordinates are not     returned, preventing us from saving the modified shapes to the database.

 

Attempted Solution:

We tried several approaches, but none were successful. Our main idea was to customize the OutSystems Maps library by modifying the "UniqueId" in the Shapes webblocks (polylines/polygons) to accept an input variable. This would allow us to generate WidgetIds dynamically and manage shapes during runtime.

  • Implementation details
    • The action "AddEmptyProjectLocation" in the webblock "Step2_Page_ProjectLocation2" is used to      create shapes.
    • We initialize the      map using the action "LeafletMapWidgetMap_Initialized" in the webblock "Step2_Block_LocationLeafletMap2".
    • This approach bypasses reliance on WidgetIds from the widget tree by using custom-generated Ids.

 

Despite these efforts, the solution did not work, and we are unsure why. We have also tried other solutions, but all of them failed. Our main goal is to be able to be far more dynamic in the drawing and editing of our shapes.

 

Request:

We are encountering multiple issues that are difficult to explain fully in writing. If the above is unclear or you need additional details, please let us know. We appreciate any guidance you can provide to help us resolve these challenges.


  • Does someone know/has ideas how to solve our problem? We have tried the Leaflet Map Forge component, however this component does not support the drawing of markers/shapes yet.

Kind regards,


Alex Ruinen

2025-11-18 12-43-07
Mariana Junges
Champion

Hello,

I've never used the Leaftet Map forge component, but I think it has the option to draw. For more freedom, the leaflet Javascript library is an open source library for interactive maps. You can draw lines, polygons and other shapes directly on the map, I would try to use the leaflet directly, not the component.

https://leafletjs.com/index.html

Let me know if it worked.

UserImage.jpg
Alex Ruinen

Hi Mariana,

Thank you for the quick reply! 

I haven't found the option to draw (and receive the drawn coordinates) in the Leaflet map Forge component and have searched for it thoroughly. If you do think that is has the option to draw, could you refer it to me?

As for your suggestion. Do I understand correctly that your suggestion would be to create my own OutSystems library that refers to the Leaflet JavaScript Library (https://leafletjs.com/index.html)? 

Kind regards,

Alex

2025-11-18 12-43-07
Mariana Junges
Champion

Hello,

As I said, I've never used the component in ODC, but a quick look at the description, actions and the demo (links below) makes it seem like there's an option.

"LeafletJS map wrapper for ODC. You can easily enable a map on any web page and add markers, circles and more to it."

Leaflet O11: https://www.outsystems.com/forge/component-overview/6907/leafletjs-reactive-o11
Demo O11: https://www.outsystems.com/forge/component-overview/7518/leaflet-draw-demo-o11
Leaflet ODC: https://www.outsystems.com/forge/component-overview/18328/leaflet-odc

Test the demo in O11, and see if there is anything you can adapt to ODC - at the moment I don't have my ODC environment active to share an OML or give more step-by-step instructions.

My idea would be - if the component doesn't work for you and your case - add the external library and customize it as you want. 
If I can help in any way, let me know

Capture.JPG
2025-01-29 14-19-26
ignesiyasloyala M

May be you try to implement geoman library which has all annotation features like drawings polygon , rectangle, markers etc and once drawn we can fetch a drawn layers by using some inbuilt methods available in geoman and we can render json using some other inbuilt methods 


Check below documentation for more details 

https://geoman.io/docs/leaflet/category/getting-started

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