Using a leaflet widget to draw shapes and markers and save as GeoJSON #4200
stefan-korn
started this conversation in
Show and tell
Replies: 1 comment
-
Wow can't wait to test this out @stefan-korn! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
DKAN D7 used the leaflet widget to allow drawing shapes and markers on a map and save them into a field of a dataset.
I have created module DKAN Geo Widget to allow for this (in a somewhat simple way now) in DKANv2 too.
If the module is enabled you can use the key dkan_geo_widget instead of textarea in your schema.ui.json to enable the leaflet widget on given property.
You will get a textarea box and leaflet map. They should synchronize. So if you change something on the map it will be put back in the textarea (from where it will be saved) and if you put valid GeoJSON in the textarea this should be put out on the map.
This is early stage, surely needs some polishing an testing, but does work in my project for now.
There are some hardcoded parts that should be configurable. Validation has not been considered yet. I am not sure if all options of the geoman toolbar work correctly, maybe some adjustments need to be made there. Few other things missing for sure too.
That said the widget is based on leaflet and leaflet geoman and some borrowings are made from the Drupal Leaflet module and the Leaflet Widget module (the js part).
Beta Was this translation helpful? Give feedback.
All reactions