I use the Mapping Module and it works well that my items are displayed as points on the map. I know that I can also load WMS layers on the map. However, in my case I only have a GeoJson to draw additional polygons to the items.
My approach is to edit view/omeka/site/page/show.phtml in my theme and use JavaScript there to load the GeoJson on the leaflet map additionally.
However, I am not able to get the map object. I have already tried:
var mappingBlock = L.DomUtil.get($(".leaflet-container")[0]);
and var mappingBlock = L.map($(".leaflet-container")[0]);
but that only led to the error: Uncaught Error: Map container is already initialized.
How can I edit the map with JavaScript afterwards?
Can I copy the file to my theme so that the next time I update the mapping module, it won’t overwrite the changes?
As a feature request it would be great if in the backend at the page there would be an input field in which GeoJSON could be entered?
Sorry for the childish mockup:
Unfortunately, I have the problem that the GeoJSON is not yet fully generic.
Is my attempt in the right direction and is this feature generally desired? Since I have not yet graduated to Omeka 4 I have developed this with the Mapping Module 1.6.0. But it should also run with the latest version.
Adding a GeoJSON field is an idea we’re considering for a future release. In fact we’re currently working on a major update to the module that introduces Polygon and LineString types. You could submit a PR, but the codebase will be significantly different than the version you’re working on.
The enhanced module is currently in testing. Moreover, it requires an unreleased version of Omeka S. We’ll release the module after it’s been tested and the required version of Omeka S has been released. Probably within the next few months.