[postgis-devel] Question about Postgis serialisation to postgresql varlena
Sandro Santilli
strk at keybit.net
Wed Aug 26 01:48:36 PDT 2015
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;
> >
> > () Free GIS & Flash consultant/developer
> > /\ http://strk.keybit.net/services.html
More information about the postgis-devel
mailing list