We are using MySQL geometry
data type to store polygons, polylines, multi-polygons and multi-polylines.
We have come across the need to store depth/height data along with some of these features. My first thought was to store this data as altitude, but then on looking at the docs I found that MySQL/MariaDB does not support altitude. Porting to PostGIS is not really an option. (in hindsight, the whole project should have been written for PostGIS).
Is there a good way to store this data? my thought was to store it in meters, positive for above ground, negative for below.
One thought was to strip the altitude property from the GeoJSON before insert into the database into an identical array structure (did some testing and it is relatively easy to do, just requires a lot of recursive looping) then stringify the data to store as a string, then do the reverse of retrieval.
at this point we don't need to do any queries on this data (but they are famous last words) so this would work.
Then I got thinking, is the order of coordinates retrieved from MySQL always guaranteed to be in the same order? as if the order changes for any reason my data becomes invalid.
I had briefly thought of storing each point individually in a table but as we use a fair few geometry functions on the data, that seems like a very poor way to do it as we would have to build the data back into geometry on the fly to do this.
Is there a better way that I am missing? unfortunately each point can potentially be a different height, so we can't just have a column of double
type