[postgis-tickets] [PostGIS] #2870: Binary insert into geography column results in value being inserted as geometry.

PostGIS trac at osgeo.org
Fri Aug 1 22:40:37 PDT 2014


#2870: Binary insert into geography column results in value being inserted as
geometry.
------------------------+---------------------------------------------------
 Reporter:  andrewdone  |       Owner:  pramsey
     Type:  defect      |      Status:  new    
 Priority:  medium      |   Milestone:         
Component:  postgis     |     Version:  2.1.x  
 Keywords:              |  
------------------------+---------------------------------------------------
 Hi,

 Please see example (in Java) attached. Here's what it does:
 1) Creates a table with an ID and Geography(Point, 4326)
 2) inserts a row using WKT.
 3) inserts a row using WKB (as bytes).
 4) Prints out id, point, and ST_SUMMARY(point).

 -- The result of step #4 is:
 ID: 1, WKB: 0101000020E610000009C6C1A5E3E662406BB75D68AEED40C0,
 Summary:Point[GS]
 ID: 2, WKB: 0101000020E610000009C6C1A5E3E662406BB75D68AEED40C0,
 Summary:Point[S]
 --

 You'll notice that:
 1) The WKB for both #1 and #2 are the same; and
 2) The flags in the ST_Summary result for #1 are [GS], where for #2 (the
 binary) they're [S].

 The documentation for ST_Summary would indicate that #2 has spatial
 information, but is not geodetic (i.e. not geography).

 I'm writing a Java library that seeks to persist geography as binary, but
 this would seem to indicate that it isn't possible. Also, is it normal
 that this should be allowed to happen anyway (i.e. writing a value to a
 geography column that's not geography)?

 Versions:

 -- POSTGIS
 POSTGIS="2.1.3 r12547" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.7.1, 23
 September 2009" GDAL="GDAL 1.9.0, released 2011/12/29" LIBXML="2.7.8"
 LIBJSON="UNKNOWN" TOPOLOGY RASTER

 -- POSTGRES
 PostgreSQL 9.3.5 on x86_64-unknown-linux-gnu, compiled by gcc
 (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit

 Example Java is also available here: https://github.com/ayuudee/issue-
 pad/blob/master/src/com/jesusthecat/im/pggeog/BinaryGeogTest.java

 Cheers,
 Andrew.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2870>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list