[postgis-devel] BOX3D strange behaviour

Even Rouault even.rouault at spatialys.com
Thu Feb 18 01:17:22 PST 2016


Le jeudi 18 février 2016 10:03:54, Rémi Cura a écrit :
> So what is the point to have a Box3D,
>  as any use of it requires it to be casted to geometry,
> which turns it into a box2D?
> (Maybe I missed a way to use this 3D box with a 3D index so it uses Z? )
> 
> Is there any way to perform &&& in all 3 dimensions?
> 
> My problem is "give points whose X, Y, Z are inside the range R1,R2,R3",
> and I'd prefer have one 3D geom gist index rather than 3 btree index on
> coordinates.
> 
> I was thinking the 3DBox was smart, untill I spent quite some time tracking
> subsequent errors to postgis.

The following hack seems to work :

SELECT  st_geomfromtext('multipoint z (0 0 0,10 10 10)')  &&& ST_Makepoint(5,5,-1);
 ?column? 
----------
 f
(1 ligne)


SELECT  st_geomfromtext('multipoint z (0 0 0,10 10 10)')  &&& ST_Makepoint(5,5,3);
 ?column? 
----------
 t
(1 ligne)



> 
> Cheers,
> Rémi-C
> 
> 2016-02-18 9:53 GMT+01:00 Even Rouault <even.rouault at spatialys.com>:
> > Le jeudi 18 février 2016 09:37:41, Sandro Santilli a écrit :
> > > On Wed, Feb 17, 2016 at 11:33:12AM -0800, Paul Ramsey wrote:
> > > > > On Feb 17, 2016, at 10:46 AM, Rémi Cura <remi.cura at gmail.com>
> > > > > wrote:
> > > > > 
> > > > > SELECT 'BOX3D( 0 0 0, 10 10 10)'::box3D::geometry &&&
> > > > > ST_Makepoint(5,5,-1)
> > > > 
> > > > select st_astext('BOX3D( 0 0 0, 10 10 10)'::box3D::geometry);
> > > 
> > > Horrible. box3d::geometry drops the Z ?
> > > Was it always like that ?
> > 
> > Seems so:
> > 
> > => select postgis_version(), st_astext('BOX3D( 0 0 0, 10 10
> > 10)'::box3D::geometry);
> > 
> >             postgis_version            |             st_astext
> > 
> > ---------------------------------------+---------------------------------
> > ---
> > 
> >  1.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 | POLYGON((0 0,0 10,10 10,10 0,0
> >  0))
> > 
> > (1 ligne)
> > 
> > select postgis_version(), st_astext('BOX3D( 0 0 0, 10 10
> > 10)'::box3D::geometry);
> > 
> >             postgis_version            |             st_astext
> > 
> > ---------------------------------------+---------------------------------
> > ---
> > 
> >  2.0 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 | POLYGON((0 0,0 10,10 10,10 0,0
> >  0))
> >  
> > > --strk;
> > > 
> > > _______________________________________________
> > > postgis-devel mailing list
> > > postgis-devel at lists.osgeo.org
> > > http://lists.osgeo.org/mailman/listinfo/postgis-devel
> > 
> > --
> > Spatialys - Geospatial professional services
> > http://www.spatialys.com
> > _______________________________________________
> > postgis-devel mailing list
> > postgis-devel at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/postgis-devel

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com



More information about the postgis-devel mailing list