[postgis-users] Why aren't ST_ClosestPoints to polylines ST_Contained in those polylines?

Hilton Long seldomseen at scinternet.net
Sat Mar 24 12:54:37 PDT 2012



I created a table of ST_ClosestPoint()s to polylines.  I assumed that if the
closest points were on the line the queries below would give equal results,
but that's not happening.

 

"InsideWorking".simplified is a line.

"gaps".closeststartpoint is a point.

 

SELECT "gaps".closeststartpoint FROM "gaps" 

WHERE "gaps".closeststartpoint IS NOT NULL; --Query produces 462 results.

 

SELECT * FROM "gaps","InsideWorking" 

WHERE ST_Covers("InsideWorking".simplified,"gaps".closeststartpoint);
--Query produces 1228 results.

 

SELECT * FROM "gaps","InsideWorking" 

WHERE ST_Contains("InsideWorking".simplified,"gaps".closeststartpoint);
--Query produces 548 results.

 

SELECT "gaps".closeststartpoint FROM "gaps","InsideWorking" 

WHERE ST_Touches("InsideWorking".simplified,"gaps".closeststartpoint);
--Query produces 680 results.

 

----------------------------------------------------------------------------
----------------------------------------

 

SELECT "gaps".closeststartpoint FROM "gaps","InsideWorking" 

WHERE ST_DWithin("InsideWorking".simplified,"gaps".closeststartpoint,0);
--Query produces 1258 results.

 

Inspection shows the ST_DWithin() query is getting better results than the
other queries.  So I think I've got something that works, but I'd appreciate
some advice on why the others don't give similar results.

 

Thanks in advance.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120324/459bd339/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 92 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120324/459bd339/attachment.gif>


More information about the postgis-users mailing list