Welcome to the forum @danpy!
That’s awesome! Please share progress in a dedicated forum topic, if you want! I’d be very interested to hear how it goes (and help if you run into any hurdles)!
Hmm not in the farmOS or farmOS-map UI, no. But I imagine that something could be implemented in a custom module! Very interesting set of questions to think through…
For context, there are a few main pieces involved:
- farmOS has a
geometry
field on assets and logs that stores WKB (Well-known binary) in the database, and shows that as WKT (Well-known text) in the UI/API.
According to Wikipedia, WKT/WKB does support Z coordinates (TIL!):
Coordinates for geometries may be 2D (x, y), 3D (x, y, z), 4D (x, y, z, m) with an m value that is part of a linear referencing system or 2D with an m value (x, y, m). Three-dimensional geometries are designated by a “Z” after the geometry type and geometries with a linear referencing system have an “M” after the geometry type.
The question is: does the farmOS Geofield module support that? Or will it fail validation? That would be the first thing to test. If you have some 3D WKT you can paste it into the textarea below the map when you are editing a log and then save the log. That will run validation and show you an error message if it fails.
If it fails, then the next step would be to open an issue with that module and help to add support for it. I’d be happy to help with that process if we need to.
If it succeeds, great! But… that doesn’t mean it will work in the map.
- The visualization of the data is handled by farmOS-map which is a separate project from farmOS (which farmOS uses).
farmOS-map is built on OpenLayers, and provides some customized behaviors on top of it for farm management apps (like farmOS) to use. So if 3D WKT fails to render properly in the map, we may need to make some adjustments to add support for that. Right now I can tell you it was all built for 2D rendering, so there isn’t any special logic in place to handle 3D. Maybe it will “just work”, but if so then it will still appear as 2D in the map. And I would be worried about the drawing controls “flattening” the geometry if you use them to draw/edit.
The drawing controls are a custom behavior that we built for farmOS-map. So that could be a good starting place to study and understand how they work, and think through what might be needed to support 3D drawing. We’re getting to the edge of my expertise here… but I’d love to help think about it!
- It might be worth creating a custom farmOS module to experiment with all of this. Modules can add/modify farmOS-map behaviors inside farmOS.
farmOS-map behaviors are written in JavaScript. If you want to hop into the farmOS chat or one of the dev calls we can get you up and running with a dev environment to experiment in.
Makes sense, and a great idea. Also a challenging one.
Looking forward to seeing how this evolves!