[postgis-users] WKB Geometry Column

Sean M. Montague smontague at ATSDenver.com
Thu Mar 17 13:19:50 PST 2005


I figured out how to insert GeomFromWKB, which makes me realize that I
may be misunderstanding WKB.  My interest in postGIS is for creating SVG
and I'm transitioning from an Avenue/ArcObjects background to web based
implementation utilizing SVG, PHP, and hopefully postGIS.  I admit my
knowledge of databases is lacking.  Previously I used MySQL, which is a
lot easier to find answers to questions that I, as a novice to
intermediate database user, have.  I try to avoid posting a question
unless my search for an answer has turned up nothing.  I have come a
long way, but I'm still trying to grasp conceptually what is going on in
PostGIS.  What I don't get is how to utilize the WKB ability of postGIS.
I read that shp2pgsql will insert as WKB, but after much searching, I
have failed in figuring out how.  Where I read this didn't say how.
Below is what I have figured out so far.  I extracted a poly from the
database asBinary(geom) and printed it out into my SVG file.  I then
viewed source and copied the poly binary string and placed it into the
insert statement which worked, but the resulting geom in the new table
is WKT, or what I believe to be WKT.  

INSERT INTO table1 (the_geom)
VALUES
(GeomFromWKB('01060000000100000001030000000100000005000000000000C0331E59
C100000080D0874DC1000000C0331E59C1000000C0D42D58410000000053085041000000
C0D42D5841000000005308504100000080D0874DC1000000C0331E59C100000080D0874D
C1',32767));

In the database, the above Insert creates a table where the geom is
stored identically as if I had inserted with WKT.  What is it that I
don't know about WKB?  I understand that WKB is faster, which explains
my interest in it.  I thought that it would be stored as binary in the
database.  Any insight would help.



More information about the postgis-users mailing list