D
D
Dmitry Bay2018-12-09 23:08:01
MySQL
Dmitry Bay, 2018-12-09 23:08:01

How to store and group POINT MySQL?

MYSQL 5.7.23, POINT fields with INDEX NOT NULL
In general, a couple of questions that I'm struggling with, with the storage of geocoordinates:
1) In what order should geocoordinates be stored in mysql in the POINT format? latlng or lnglat . It seems Correct should be latlng. But there are some functions, for example - ST_Distance_Sphere, which requires lnglat format. And it turns out you need to do a similar crutch to request a distance:
ST_Distance_Sphere(
point(y(latlng), x(latlng)),
ST_GeomFromText(:point)
);
Please explain the best practices, as this question could not be found.
2) Tell me the best way to group POINT values ​​in a mysql query? "Group by diameter 30 meters." Perhaps rounding to the grid?
UPD. geohash solves my problem in a specific case.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question