[postgis-users] Problem finding intersection of LineString and BOX3D?

Dave Blasby dblasby at refractions.net
Mon Aug 12 10:46:34 PDT 2002


Mark Cave-Ayland wrote:
> SELECT name FROM linetesttab WHERE geom && setSRID('BOX3D(247531.5250251
> 52556.353020652,247567.13124875 52591.959244305)'::BOX3D,
> find_srid('','linetesttab','geom') ) AND truly_inside(geom,
> setSRID('BOX3D(247531.5250251 52556.353020652,247567.13124875
> 52591.959244305)'::BOX3D, find_srid('', 'linetesttab', 'geom')))

Mark,
	You could be correct - the truly_inside() function hasn't been well
tested.  Its based on the cohen-sutherland line-clip-to-box algorithm,
and I
might have missed one of the cases.

I'd recommend using the distance() function which is slower, but tested 
much better (plus its more general).

SELECT name FROM linetesttab WHERE geom && setSRID('BOX3D(247531.5250251
 52556.353020652,247567.13124875 52591.959244305)'::BOX3D,
 find_srid('','linetesttab','geom') ) AND distance(geom,
 setSRID('BOX3D(247531.5250251 52556.353020652,247567.13124875
 52591.959244305)'::BOX3D, find_srid('', 'linetesttab', 'geom'))) =0

dave




More information about the postgis-users mailing list