[postgis-users] WKB format

David Garnier david.garnier at etudier-online.com
Thu Jul 4 12:45:50 PDT 2002


OK, I think I get it from reading the source. PostGIS actually parses the binary data into an hexadecimal string and returns it. If I try to read my data with a getString, it looks fine, just like in plsql.

Now, there is a way to get the real bytes? A byte array that would match the specification of the WKB format? Or are we stuck with Strings till the end of times?

Best Regards,
David Garnier

On Thu, 4 Jul 2002 21:24:18 +0200
David Garnier <david.garnier at etudier-online.com> wrote:

> Hello,
> 
> I'm working on this WKBReader in java, and I have some problems getting the data out of postgres. I use the following query:
> select asbinary(the_geom,'NDR') as wkb , astext(the_geom) as wkt  from road_shapes limit 25
> Then I do a getBytes on wkb:
> From java I got this: 303130353030303030303031303030303030303130323030303030303033303030303030373532324331353433334641353943303130354130463546323630303434343034324231313533343244464235394330334132313734443032353030343434303734354643453643353746433539433032334639344132303235303034343430
> 
> From plsql, I got this:
> 0105000000010000000102000000030000007522C15433FA59C0105A0F5F2600444042B115342DFB59C03A2174D025004440745FCE6C57FC59C023F94A2025004440
> 
> I think that there is two problems: the fourth bit of the each byte is set null. That would explain why there is no values above 7.
> 
> I'm thinking that this might be related to different encoding schemes between Java and postgres.
> 
> I figured that I would just ask around before diving head first into the source code of postgis.
> 
> Best Regards,
> David Garnier
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 




More information about the postgis-users mailing list