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?