Answer the question
In order to leave comments, you need to log in
How to get points within a given area in PostGIS?
I have a table with places. The table has a column coordinates of type geography(POINT), coordinates from Google maps.
The task is to select places that are included in a certain area on the map (a section of Google maps visible on the front).
From the front, they send me the coordinates of the lower left and upper right corners, theoretically, you can try to get all four.
I can't figure out the postgis docs.. I looked at the ST_Contains and ST_CoveredBy functions, but somehow I didn't really understand.. the examples in the docs are not very clear. Or maybe he didn't look.
Answer the question
In order to leave comments, you need to log in
From these coordinates of the corners, draw a line. Then look for the intersection of the enclosing rectangles for the given line and your points.
SELECT * FROM table WHERE geom && 'LINESTRING(0 0, 3 3)'::geometry
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question