S
S
semendef2019-06-19 17:22:04
PostgreSQL
semendef, 2019-06-19 17:22:04

Why can't I get data from postgis by coordinates?

Postgres 9.3, database based on data from openstreetmap, trying to get data by coordinates, but an empty response is returned, tried to give data from other coordinate systems, which leads to an error, what could be wrong in the request?

SELECT * FROM planet_osm_polygon
WHERE st_within(ST_MakePoint(37.601675181742, 55.750958697655), way);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
freeExec, 2019-06-19
@semendef

The documentation clearly states that projections for geometries must be specified, i.e. ST_SetSRID, plus they must be the same. And you have one WGS84, and the other (by default) PseudoMercator.

R
Rsa97, 2019-06-19
@Rsa97

Try with an explicit SRID

SELECT * 
  FROM planet_osm_polygon
  WHERE st_within(ST_SetSRID(ST_MakePoint(37.601675181742, 55.750958697655), 4326), way);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question