[postgis-tickets] [PostGIS] #4159: ST_Distance failing with a geography and a point with specific values

PostGIS trac at osgeo.org
Mon Aug 27 04:20:43 PDT 2018


#4159: ST_Distance failing with a geography and a point with specific values
-------------------------+--------------------------------
 Reporter:  GustavoAcid  |      Owner:  pramsey
     Type:  defect       |     Status:  new
 Priority:  medium       |  Milestone:  PostGIS PostgreSQL
Component:  postgis      |    Version:  2.2.x
 Keywords:  ST_Distance  |
-------------------------+--------------------------------
 In our project we are loading geographies from different countries from
 shapefiles to Postgis (using shp2pgsql) and later querying if specific
 points are within some distance from said geographies.

 The problem arose when we made the query if this specific coordenates
 {{{(-3.6765233, 40.5036783)}}} are inside the Spanish territory (shapefile
 used attached). The point is in the center of Madrid, but ST_Distance
 between the geography and the points gives {{{242445.14066125}}} as
 result.

 Query Used
 {{{
 #!sql
 SELECT ST_Distance(regions.area, ST_SetSRID(ST_Point(-3.6765233,
 40.5036783), 4326)::geography) as result
      FROM regions
      WHERE id = 1;
 }}}

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4159>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list