Saving spatial points in Symfony 2 / Doctrine 2 Entities?

Symfony 2 does not support the spatial point type supported by MySQL. I could not find anything in the Doctrine 2 documentation for this particular data type, so does anyone know how to work with dots in Symfony 2? Also, how to query based on radius? Thank you :)

+6
source share
3 answers

The easiest way is to implement custom types for spatial data types, and then declare custom DQL functions to simplify their query.

I wrote about this here: http://codeutopia.net/blog/2011/02/19/using-spatial-data-in-doctrine-2/

+9
source

Another option would be to use the djlambert / doctrine2-spatial bundle found here: https://github.com/creof/doctrine2-spatial

No need to implement any custom content.

+4
source

If you speak French, youd might get inspired in another article here: http://blog.fastre.info/2012/02/doctrine2-2-2-et-types-geographiques/

These classes were created for the Postgresql + Postgis database.

+1
source

Source: https://habr.com/ru/post/914085/


All Articles