[postgis-users] Upgrading PostGis: parsing geometries
Guido Lemoine
guido.lemoine at jrc.it
Fri Aug 26 05:20:52 PDT 2005
Hi all,
While upgrading to postgresql 8 and postgis 1.0.3 I came across the
following
problems. They appear to be due to a change in the parser of the text
strings
that build up the geometries. These problems did not exist before (< 1.0.x).
select SetSRID('BOX3D(10 20 , 30 40)'::box3d, 4326);
ERROR: BOX3D parser - couldnt parse. It should look like: BOX3D(xmin
ymin zmin,xmax ymax zmax) or BOX3D(xmin ymin,xmax ymax)
This is because there is a space after 20 just before the comma. You'd
expect the
parser to do some trimming before parsing.
The other one is far more annoying, however:
select geometryfromtext('POINT(34. 22.)', 4326);
ERROR: parse error - invalid geometry
however, if you add a 0 after the decimal point (or remove the decimal
point),
it works:
Positions=# select geometryfromtext('POINT(34.0 22.0)', 4326);
geometryfromtext
----------------------------------------------------
0101000020E610000000000000000041400000000000003640
(1 row)
A float without a trailing 0 is parsable in any normal programming
language. It's a real pain.
Guido Lemoine
More information about the postgis-users
mailing list