[postgis-users] expand() and accuracy

strk at refractions.net strk at refractions.net
Fri Apr 22 06:56:39 PDT 2005


Try forcing geometry::box3d cast instead of relying on the default.
--strk;

On Fri, Apr 22, 2005 at 03:48:01PM +0200, Hubert Fröhlich wrote:
> Hi list,
> 
> I am using Postgres 8.0.0, Postgis 1.0.0 RC1 and geos 2.1.1 under SuSE 
> Linux 9.2.
> Folgendes Problem:
> 
> When using expand(geometry, distance) I found that
> 
> select astext(expand(geometryfromtext('MULTIPOLYGON(((4450000 
> 5400000,4450000 5400011,4450011 5400011,4450011 
> 5400000,44500005400000)))',31468),1));
>                                           astext
> --------------------------------------------------------------------------------------------
> POLYGON((4449999 5399999,4449999 5400012,4450012 5400012,4450012 
> 5399999,4449999 5399999))
> 
> is ok for distance = 1, and also for the following
> 
> select astext(expand(geometryfromtext('MULTIPOLYGON(((4450000 
> 5400000,4450000 5400011,4450011 5400011,4450011 
> 5400000,44500005400000)))',31468),1.5));
>                                                     astext
> ----------------------------------------------------------------------------------------------------------------
> POLYGON((4449998.5 5399998.5,4449998.5 5400012.5,4450012.5 
> 5400012.5,4450012.5 5399998.5,4449998.5 5399998.5))
> 
> 
> however if I enter small values for "distance", as 0.05 , I get
> 
> select astext(expand(geometryfromtext('MULTIPOLYGON(((4450000 
> 5400000,4450000 5400011,4450011 5400011,4450011 
> 5400000,44500005400000)))',31468),0.05));
>                                           astext
> --------------------------------------------------------------------------------------------
> POLYGON((4450000 5400000,4450000 5400011,4450011 5400011,4450011 
> 5400000,4450000 5400000))
> 
> I don´t get what i`d expect.
> Moreover, if I use geometries with small values everything seems OK again.
> 
> select astext(expand(geometryfromtext('MULTIPOLYGON(((4450 5400,4450 
> 5400,4450 5400,4450 5400,4450 5400)))',31468),0.05));
> 
>            astext
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> POLYGON((4449.9501953125 5399.9501953125,4449.9501953125 
> 5400.0498046875,4450.0498046875 5400.0498046875,4450.0498046875 
> 5399.9501953125,4449.9501953125 5399.9501953125))
> 
> 
> select astext(expand(geometryfromtext('MULTIPOLYGON(((445000 
> 540000,445000 540001,445001 540001,445001 540000,445000 
> 540000)))',31468),0.05));
>                                                               astext
> ------------------------------------------------------------------------------------------------------------------------------------
> POLYGON((444999.9375 539999.9375,444999.9375 540001.0625,445001.0625 
> 540001.0625,445001.0625 539999.9375,444999.9375 539999.9375))
> 
> 
> 
> I guess it has to do with accuracy handling (small distance and big 
> geometry coordinates) . Anybody who knows a solution or an explanation?
> 
> Thanks.
> -- 
> Mit freundlichen Grüßen / With kind regards
> 
> Hubert Fröhlich
> 
> -------------------------------------------------------------------------------
> Dr.-Ing. Hubert Fröhlich			
> Bezirksfinanzdirektion München 			
> Alexandrastr. 3, D-80538 München, GERMANY
> Tel. :+49 (0)89 / 2190 - 2980
> Fax  :+49 (0)89 / 2190 - 2997
> hubert dot froehlich at bvv dot bayern dot de
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list