Answer the question
In order to leave comments, you need to log in
Working with geodata?
Good afternoon. Please answer the question about the work of geolocation. I have never faced such tasks, and some things cause difficulty.
Situation:
I have raw data in a database, this database has two columns (named latitude and longitude).
As a request, the route comes in the form of an array (latitude longitude). I need to select records that are related to this route.
How can I build the query correctly?
I also have questions about the technique for calculating the belonging of one point to another. Who has links to some kind of sensible articles where all this topics are dealt with from scratch?
UPD: ok. I now have a clickhouse from Yandex there, but there is also a postgress.
Exactly what I'm thinking now:
I see in the database documentation, creating a geo index
SELECT geoToH3(37.79506683, 55.71290588, 15) as h3Index
in current coordinates, it should be:
644325524701193974 something like that.
then I take the coordinates from the request and also converting them into an index, I can compare belonging to what? How to compare single index with route ?
How is it done in real projects? Who can tell?
Answer the question
In order to leave comments, you need to log in
It is best when the point is stored as a geometry object - postgresql has the ability to determine the intersection of geometry objects.
And if there are two separate fields, then you need to calculate the distance, and if it is less than N meters, then the point is needed.
for short distances, the calculation of a right-angled triangle is suitable, for large distances
- the Haversin formula
(y0-y)^2
if there are geometric functions - then a point is a circle with a radius of N meters that intersects with a broken path line.
If they are not there, then you will have to include the entire calculation in the request, and it will turn out to be indecently long. Approximately - can be found by comparing all waypoints with record points, finding the minimum distance.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question