Opened 15 years ago
Last modified 13 years ago
#12010 closed
GEOSGemoentry hex method does not return HEXEWKB — at Initial Version
Reported by: | James | Owned by: | nobody |
---|---|---|---|
Component: | GIS | Version: | 1.1 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The documentation states that the hex member returns the HEXEWKB of a geometry. This isn't true, it is only returning the hex value without the SRID embeded into it as the HEXEWKB should.
Example of issue:
(FROM PYTHON)
p = django.contrib.gis.geos.GEOSGeometry('POINT(2 3)',4326)
p.ewkt
'SRID=4326;POINT (2.0000000000000000 3.0000000000000000)'
p.hex
'010100000000000000000000400000000000000840'
(FROM PostGres with PostGIS)
postgres=# SELECT GeometryFromText('POINT(2 3)', 0);
geometryfromtext
----------------------------------------------------
01010000200000000000000000000000400000000000000840
(1 row)
postgres=# SELECT GeometryFromText('POINT(2 3)', 4326);
geometryfromtext
----------------------------------------------------
0101000020E610000000000000000000400000000000000840
(1 row)
The output above verifys that the SRID information isn't being returned as part of the hex result of the geometry. Either the documentation is incorrect and a method should be provided that does return the HEXEWKB or there is a bug where the srid isn't being considered when calculating the HEXEWKB value.
The documentation I am looking at:
http://geodjango.org/docs/geos.html#hex