[DONE] Geospatial fields

The way I have been trying to get around this issue is by building a small mapping tool where you can create a map (including adding some popups and controlling basic styling) and the URL-encode it so that you can save it in a URL field in fibery. It is based on leaflet and the leaflet-geoman library with a few additional tools.

I’ve got some information and details on how to use the tool below in case it is of interest:

Toolbar Explanation

Editor Window

You can also add some data and style the features by using the edit feature data tool (pencil icon) and then clicking individual features:

I’ve tried to hack together various ways of making the URL as compact as possible, but there is still a limit to how much data can be transmitted this way. The URL is still very long and ugly to store in a URL field in fibery, so I go through an additional step of running it through url shortner.

You can try it if you want at QuickMap and can fork the repo (GitHub - cannibalflea/quickmap) if you would like to play around and improve it (e.g. move the centre/zoom to your area of primary interest). I have to say this was a couple of hours of work here and there and it is probably one of the most poorly-written pieces of code on the internet. I am hoping to clean it up in the future and add some other tools. I also need to add some of the images above to the readme to make using it easier.

I was initially going to save the GeoJSON in fibery in a rich-text field and maybe just pass an ID to the tool and have it query fibery for GeoJSON data. But the text fields can’t properly format the JSON and there is no validation, etc. not to mention how ugly it looks. The rich-text fields also are more particular in terms of access through the API, so I thought it makes more sense to do it this way for now.

This approach only allows you to visualize content on a map but doesn’t really help with any type of spatial analysis. It is also possible to build a small app with its own backend database so that you can save content and link it to fibery entities so that you are not storing any spatial data in fibery. This also allows you to do some spatial analysis (e.g. using turf.js) as well as consume other layers, etc. However, this again takes you away from a single tool to manage your data. It also means hosting some things and managing the various pieces. I don’t know if the fibery team or community have other suggestions to make this easier.

As @Oshyan said, I am looking forward to possibility of being able to build custom blocks and extensions for fibery. However, one of the things we may need to have natively in fibery is a JSON data/field type so that other extensions can be used on top of it.

4 Likes