The WKT truncates I think at about the 15th digit where as the wkb doesn't. So yes you will lose information if you convert to WKT and have a lot of decimal places.
Leo -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Michael Orlitzky Sent: Sunday, September 27, 2009 10:39 PM To: [email protected] Subject: [postgis-users] WKT/WKB Calculations I noticed that some error is introduced when converting from WKB to WKT (and back). For example, the following computation of a polygon's area, divided by itself, should return one: SELECT (ST_Area(ST_GeomFromEWKB(ST_AsEWKB(tiger.the_geom))) / ST_Area(tiger.the_geom)) AS area_ratio FROM tiger area_ratio ------------------- 1 1 1 . . But when I convert to WKT as an intermediate format, the results get thrown off by as much as 0.1% (I realize the first couple of rows don't show this, but my tests break when the error passes that threshold): SELECT (ST_Area(ST_GeomFromEWKT(ST_AsEWKT(tiger.the_geom))) / ST_Area(tiger.the_geom)) AS area_ratio FROM tiger; area_ratio ------------------- 1 1.00000014105231 1.00000017733961 1.00000021839733 1.00000004515224 etc. Is this just a floating point limitation, or something else entirely? _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
