[postgis-users] Re: problem with BOX3D query

Mark Cave-Ayland m.cave-ayland at webbased.co.uk
Mon May 8 04:25:18 PDT 2006


> From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Randy
George
> Sent: 06 May 2006 18:21
> To: postgis-users at postgis.refractions.net
> Subject: [postgis-users] Re: problem with BOX3D query
>
> Hi,
>
>           I’m trying to find my error in a BOX3D query
>
> "PostgreSQL 8.1.2 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2
(mingw-
> special)" In Windows 2003 environment
>
>            
> SELECT the_geom FROM streets
> WHERE the_geom && SetSRID(’BOX3D(-111.80 33.30 , -111.75
33.35)’::box3d,4269);
>
> Gives ERROR:  syntax error at or near "33.30" at character 72
>
> But identical BOX3D here
> select AsEWKT(SetSRID('BOX3D(-111.80 33.30 , -111.75 33.35)'::box3d,
4269));
> Works fine?
> "SRID=4269;POLYGON((-111.8 33.3,-111.8 33.35,-111.75 33.35,-111.75
33.3,-111.8 33.3))"
>
> Substituting POLYGON
> SELECT the_geom FROM streets
> WHERE the_geom && GeomFromText('POLYGON((-111.8 33.3,-111.8 33.35,-111.75
33.35,-111.75 
> 33.3,-111.8 33.3))',4269)
> Works as expected
>
> As does he simpler LINESTRING bounding box
> SELECT the_geom FROM streets
> WHERE the_geom && GeomFromText('LINESTRING(-111.80 33.30, -111.75
33.35)',4269)
>
> However I’m curious why the BOX3D isn’t working?
>
> Thanks
> Rkgeorge


Hi Randy,

Using PostGIS 1.0.3, I see the following behaviour:

postgis=# SELECT geom FROM osgb_text
postgis-# WHERE geom && SetSRID('BOX3D(-111.80 33.30 , -111.75
33.35)'::box3d,4269);
ERROR:  BOX3D parser - couldnt parse.  It should look like: BOX3D(xmin ymin
zmin,xmax ymax zmax) or BOX3D(xmin ymin,xmax ymax)
postgis=# select postgis_full_version();
                                         postgis_full_version
----------------------------------------------------------------------------
--------------------------
 POSTGIS="1.0.3" GEOS="2.1.3" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS
DBPROC="0.3.0" RELPROC="0.3.0"
(1 row)

Removing the space before the comma in the BOX3D allows the statement to
execute without problems here. Which version of PostGIS are you using?
(SELECT postgis_full_version()). I wonder if it could be something to do
with the Geometry <-> BOX3D cast used to query the indices.


Kind regards,

Mark.

------------------------
WebBased Ltd
17 Research Way
Plymouth
PL6 8BT

T: +44 (0)1752 797131
F: +44 (0)1752 791023

http://www.webbased.co.uk  
http://www.infomapper.com
http://www.swtc.co.uk 

This email and any attachments are confidential to the intended recipient
and may also be privileged. If you are not the intended recipient please
delete it from your system and notify the sender. You should not copy it or
use it for any purpose nor disclose or distribute its contents to any other
person.





More information about the postgis-users mailing list