[FWTools] Converting polygon shapefiles to PostgreSQL without PostGIS

C. Scott Smith cssmith at uci.edu
Mon Jan 9 21:04:31 EST 2006


I am using the FWTools command "ogr2ogr -f 'PostgreSQL'" to convert ESRI
shapefiles to PostgreSQL format (Postgresql version 7.4).  Using this
command, I have successfully converted ESRI shapefile attribute data to
PostgreSQL format, and it appears that the geometry of the shapefile is, by
default, parsed to a column named "wkb_geometry" in "bytea" or binary
format.  My question: Is it possible, using FWTools, to convert the geometry
data in the field "wkb_geometry" from data type "bytea" to another native
PostgreSQL geometry data type such as "point" or "polygon" so I may perform
various spatial queries?  The -nlt option doesn't seem to work.  Otherwise,
is there a standard PostgreSQL function that supports a bytea to geometry
conversion?  A fairly extensive web search returned no solutions.

It is likely that much, if not all, of the stated problem is related to the
fact that I am working on a shared server that does not have PostGIS
libraries installed so I am stuck using the basic functionality of
PostgreSQL. Note also that I was able to populate a PostgreSql "point" field
by referring to X and Y data in the attribute table (e.g., update table_name
set pointfield= point(longitude, latitude), however, this method is not so
easy to populate a polygon field.



More information about the FWTools mailing list