[postgis-users] WKB Geometry Column

Sean M. Montague smontague at ATSDenver.com
Fri Mar 18 09:21:03 PST 2005


Does this sound reasonable?  Given that pulling from the database is
faster as WKB, would it be worth the effort to develop a client side app
that parses the binary data, and appends the node of an empty SVG
document.  I know this is possible with JS, appending nodes of svg
documents once they're client side.  What are the possible pros and cons
of doing this?  Thanks.

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Paul
Ramsey
Sent: Thursday, March 17, 2005 3:17 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] WKB Geometry Column

Stephen Woodbridge wrote:

> I have follow up questions.
> What applications on the client side use the WKB format now?

Mapserver, Geotools (Geoserver / uDig), for a few.

> Where is the WKB format documented?

In the OpenGIS SGSQL standard. Probably we should copy that description 
into our own documentation.

> As I think it would make sense to build a PHP and Perl Class the can 
> parse the WKB into data structures if they don't already exist. Do
these 
> already exist?

Not sure. I have done half-assed perl WKB handlers in the past, but they

are long gone into the bit bucket...

Paul

> 
> -Steve
> 
> Paul Ramsey wrote:
> 
>> Sean,
>>
>> You are confusing storage format with inout/output format. No matter 
>> how you get data *into* postgis, it will be stored the same way,
using 
>> the same internal structure. You have three choices for getting data 
>> into and out of postgis:
>>
>> - Use the "canonical format". This is a string representation of the 
>> internal format. It might change, if we want to change the internal 
>> format. It currently looks a lot like WKB, but it is not. You can see

>> the canonical format by going "select geom_column from geom_table".
>> - Use WKT. This is a human readable form of the geometry, using 
>> numbers and brackets and whatnot.  You can see the WKT format by
going 
>> "select astext(geom_column) from geom_table".
>> - Use WKB. This is a computer readable form of hte geometry, a 
>> byte-stream.  You can see the canonical format by going "select 
>> asbinary(geom_column) from geom_table".
>>
>> The only thing that is "faster" about WKB is your handling of it on 
>> the client side. It is much faster for client software to parse the 
>> byte-stream than it for it to parse WKT. PostGIS itself will not have

>> noticably different performance if you use WKB or WKT on output.
>>
>> Paul



More information about the postgis-users mailing list