Store field value as GEOMETRY spatial data type in MySQL backend

Created on 8 November 2021, about 3 years ago
Updated 19 August 2024, 4 months ago

Problem/Motivation

When we are actively working with Geographic data, very often we need to find nearest point to some coordinates, or polygons that contains some point, and more other.

All that functions are already exists on database side, for example in MySQL we can find all polygons, that contains point, using a ST_Contains(g1, g2) function, documentation. Similar features are present in PostgreSQL too.

But Geofield module now stores geometry as simple string (longblob) field type, that makes impossible to use of those database functions to work with Spatial Data.

Proposed resolution

Will be good to add option to store field value as GEOMETRY datatype, instead of longblob like now.

This data can be converted to-from WKT using build-in database functions, like ST_AsWKT(), so that conversion will not broke previous behavior and don't needs a lot of changes in current code.

But this will give to developers a lot of more flexibility to work with geographic data without duplicating data manually in separate fields!

What do you think about this idea?

Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇦🇲Armenia murz Yerevan, Armenia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇺Australia nigelcunningham Geelong

    The referenced commit still makes the field a blob for mysql. I tried changing it to a geometry field manually on my local and could do so but was then unable to import data via a feed. I assume more changes are needed for mySQL / mariadb.

Production build 0.71.5 2024