[postgis-users] st_intersects not working

Rhys A.D. Stewart rhys.stewart at gmail.com
Wed Feb 11 11:25:08 PST 2015


Greetings all,

I am working on a set of data where I have noded linestrings. All
linestrings have just two points and the nodes were derived from the
endpoints.

I've found one instance where st_intersects and st_equals return the
incorrect value (AFAICT).

==============================
select
  a.fid, b.fid, st_astext(a.g), st_astext(b.g),
  st_equals(st_startpoint(b.g),a.g ) start_equals,
  st_equals(st_endpoint(b.g),a.g )end_equals,
  st_astext(st_endpoint(b.g)) = st_astext(a.g) end_text_equals,
  st_astext(st_startpoint(b.g)) = st_astext(a.g) start_text_equals
from gn.primaryline_nodes a
join gn.primaryline b on /*st_intersects(a.g,b.g) --*/
st_dwithin(a.g,b.g,.05)
where a.fid = 6097;
---------------------------------------
fid fid st_astext st_astext start_equals end_equals end_text_equals
start_text_equals
6097 16202 POINT(767513.95 656360.7) LINESTRING(767499.7
656360.55,767513.95 656360.7) False False True False
6097 16201 POINT(767513.95 656360.7) LINESTRING(767513.95
656360.7,767516.95 656361.6) False False False True
===================

version info:
POSTGIS="2.1.1 r12113" GEOS="3.4.2-CAPI-1.8.2 r3924" PROJ="Rel. 4.8.0, 6
March 2012" GDAL="GDAL 1.10.0, released 2013/04/24" LIBXML="2.7.8"
LIBJSON="UNKNOWN" TOPOLOGY RASTER
PostgreSQL 9.3.0, compiled by Visual C++ build 1600, 64-bit

I did a select into a new schema and the same issue occurred. I did an
`update table set g = st_astext(g)::geometry` and it works fine after that.
​
​
I've posted a dump here:
https://gist.githubusercontent.com/rhysallister/3d3c59c204db726f5068/raw/gistfile1.txt

Maybe someone can reproduce it. The offending fid from the
primarylines_node table is 6097

Regards,


Rhys
Peace & Love|Live Long & Prosper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20150211/49602032/attachment.html>


More information about the postgis-users mailing list