[postgis-users] intersection() box2d

Nicolas Ribot nicky666 at gmail.com
Fri Jun 3 04:05:26 PDT 2005


> Hi Users!
> 
> Is it possible to use BOX2D within the 'intersection'-command?
> 
> e.g.: select intersection(GeometryFromText('BOX2D(2578271
> 5622034,2579725 5623110)'), GeometryFromText('LINESTRING(2578664.06
> 5623016.69,2583790.06 5624136.29)'))
> 
> 
> With BOX3D it seems not to work. But perhaps with BOX2D...
> 
> 
Hi,
You should try to cast your box2d into a valid geometry.
On postgis 1.0, this is something like:

select intersection(
setSRID('BOX(2578271 5622034,2579725 5623110)'::box2d, -1), 
GeometryFromText('LINESTRING(2578664.06 5623016.69,2583790.06 5624136.29)', -1)
)

setSRID transforms box2d into a geometry.
I don't know exactly how to do that on 0.9, as geometric textual
representations have changed a bit, i think.

Nicolas



More information about the postgis-users mailing list