[postgis-devel] Question about Postgis serialisation to postgresql varlena

Karel Maesen karel at geovise.com
Wed Aug 26 05:55:17 PDT 2015


My mistake… I misunderstood. 

Btw, the user apparently got EWKT because he was still using postgis JDBC extensions. 

Thanks for the help!

Karel

> On 26 Aug 2015, at 14:02, Sandro Santilli <strk at keybit.net> wrote:
> 
> On Wed, Aug 26, 2015 at 01:26:44PM +0200, Karel Maesen wrote:
>> Sorry to come back to this…
>> 
>> I tried to figure out why I get a different value in my test cases then the user reporting the exception. After some investigation, turns out that the JDBC driver always requests data in text (that is what it specifies in the BIND message at any rate).  So, why do I get hex-encoded EWKBs? Am I missing something?
> 
> As I said, the canonical text form is HEXEKWB,
> which is hex-encoded EWKB.
> 
> --strk;
> 
>>> On 26 Aug 2015, at 10:48, Sandro Santilli <strk at keybit.net> wrote:
>>> 
>>> On Wed, Aug 26, 2015 at 10:40:49AM +0200, Karel Maesen wrote:
>>>> Hello Sandro,
>>>> 
>>>> Thank you for your quick answer.  How is HEXEWKT different from EWKT?
>>> 
>>> Sorry, it was a typo, the canonical text form is HEXEWKB, there's no
>>> such thing as HEXWKT.
>>> 
>>> Basically canonical binary is EKWB and canonical text is the hexified
>>> version of that.
>>> 
>>> --strk;
>>> 
>>>> 
>>>> Regards,
>>>> 
>>>> Karel
>>>> 
>>>> 
>>>>> On 26 Aug 2015, at 10:34, Sandro Santilli <strk at keybit.net> wrote:
>>>>> 
>>>>> On Wed, Aug 26, 2015 at 10:27:25AM +0200, Karel Maesen wrote:
>>>>>> Hi list,
>>>>>> 
>>>>>> I’m the lead developer of Hibernate Spatial. Hibernate Spatial adds support for spatial types and operations to the Hibernate Object-Relation Mapping, which is very popular in the Java world. 
>>>>>> 
>>>>>> Recently I started using my own code to perform the deserialisation from Postgis Geometry to Java objects. As reference I used the description in the source file ./postgis/SERIALIZED_FORM and https://trac.osgeo.org/postgis/wiki/DevWikiPostGISCoding. I was under the impression that, at least from version 1.0 of Postgis, this file documents the internal varlena serialisation format of the Geometry type. 
>>>>>> 
>>>>>> Now I have received a bug report saying that the deserialization of a geometry failed. Apparently the Geometry returned from the database is encoded in an EWKT text value, not the binary object described in SERIALIZED_FORM.  
>>>>>> 
>>>>>> Is it possible that a Postgis 1.5.2 database contains geometries serialized as EWKT text? Could any of the Postgis developers confirm that the format in SERIALIZED_FORM is the only format possible?
>>>>> 
>>>>> The object is stored in the database with a theoretically opaque
>>>>> format, and it gets transformed to a "canonical" format when retrived.
>>>>> 
>>>>> PostgreSQL accounts for two "canonical" forms: binary and text.
>>>>> Which one is used depends on the cursor you use for fetching the data
>>>>> (binary or text).
>>>>> 
>>>>> The canonical text output is HEXEWKT, the canonical binary output is EWKB.
>>>>> This hasn't changed between 1.5 and 2.0.
>>>>> 
>>>>> --strk; 
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel




More information about the postgis-devel mailing list