[postgis-users] Geometric precision
strk at refractions.net
strk at refractions.net
Fri Feb 3 01:59:16 PST 2006
On Thu, Feb 02, 2006 at 02:56:44PM +0100, Tim Baumgartner wrote:
> Hi,
>
> I have two questions. Perhaps somebody can help
>
> 1.
> I am porting a GIS-related application from Oracle to PostGIS. In
> Oracle, It was possible to define the precision of spatial data, so that
> two points x(0.001, 3) and y(-0.001, 3) might be considered equal by the
> database. Is something like that possible in PostGIS as well?
You can filter your geoms using SnapToGrid.
> 2.
> I noticed something that I don't understand when testing spatial queries:
>
> insert into testtable values(GeomFromText('POINT(10.3 10.3)'));
> SELECT * FROM testtable where g && SetSRID('BOX3D(10.300001 10,
> 11 11)'::box3d,-1)
>
> => found something
>
> SELECT * FROM testtable where g && SetSRID('BOX3D(10.30001 10,
> 11 11)'::box3d,-1)
>
> => found nothing
>
> Is there a rule for this behaviour? Does it have something to do with
> the fact that I am using -1 for SRID?
Nothing to do with SRID, precision should be the problem.
SnapToGrid both inputs (g and BOX) and see what happen.
BTW, there was a bug in SnapToGrid that would likely give
you problems, better always dropbbox() unless you upgrade to
postgis head (1.1.2CVS):
// this should work:
DropBBOX(SnapToGrid(g)) ....
--strk;
More information about the postgis-users
mailing list