[postgis-users] AsBinary returns differing values on different systems

Tobias Sauerwein tobias.sauerwein at camptocamp.com
Wed Apr 14 02:09:11 PDT 2010


Hi!

For unit tests I was comparing the hex values returned by AsBinary(), but it
seem like that AsBinary() returns different values on different systems (but
only sometimes). Please consider the following query:

select AsBinary(Centroid(GeomFromText('LINESTRING(-88.6748409363057
43.1035032292994,-88.6464173694267 42.9981688343949,-88.607961955414
42.9680732929936,-88.5160033566879 42.9363057770701,-88.4390925286624
43.0031847579618)', 4326)));

On a 32-bit system with PostGIS 1.3.3 the following is returned:
 \001\001\000\000\0006l\362\211\354$V\300\033\266f\215\353~E@

But on a 64-bit system with PostGIS 1.3.5 the following:
 \001\001\000\000\0007l\362\211\354$V\300\033\266f\215\353~E@
                                ^

But somehow it is the same geometry which you can see with the following two
queries:

select
AsText(GeomFromWKB(AsBinary(Centroid(GeomFromText('LINESTRING(-88.6748409363057
43.1035032292994,-88.6464173694267 42.9981688343949,-88.607961955414
42.9680732929936,-88.5160033566879 42.9363057770701,-88.4390925286624
43.0031847579618)', 4326))), 4326));

or

select AsText(Centroid(GeomFromText('LINESTRING(-88.6748409363057
43.1035032292994,-88.6464173694267 42.9981688343949,-88.607961955414
42.9680732929936,-88.5160033566879 42.9363057770701,-88.4390925286624
43.0031847579618)', 4326)));


Then both systems return:
POINT(-88.5769371859941 42.9915634871979)


I originally thought that the precision may be different on the two systems,
but then the WKT values would not be the same. Or does WKT use a different
precision then WKB?

Thank you,
Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100414/56cb0d17/attachment.html>


More information about the postgis-users mailing list