intersection() box2d

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

intersection() box2d

Martin Weiße
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...


used versions:

Postgresql 7.4.6
PostGis 0.9


Thanks & Cheers

Martin

--

_____________________________________

terrestris GbR
Martin Weiße
Siemensstr. 8
D-53121 Bonn

T: ++49 (0)228 - 962 899 51
F: ++49 (0)228 - 962 899 57

Internet: www.terrestris.de
E-Mail: [hidden email]
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: intersection() box2d

Nicolas Ribot
> 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
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: intersection() box2d

strk
On Fri, Jun 03, 2005 at 01:05:26PM +0200, Nicolas Ribot wrote:

> > 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.

The setSRID just expects a geometry, and postgresql automatically
casts the box2d into one, anyway your example should fail as
you never tell postgresql that string is a box2d type, you
could use 'BOX2D(...)'::box2d::geometry for an explicit cast, or
just 'BOX2D(...)'::box2d and let pgsql automatically cast it
to geometry to fit into intersection() args list.

--strk;

>
> Nicolas
> _______________________________________________
> postgis-users mailing list
> [hidden email]
> http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[hidden email]
http://postgis.refractions.net/mailman/listinfo/postgis-users
Loading...