maschinenmensch / edifice

A database of the built environment in Chicago
5 stars 1 forks source link

Error messages during setup_edifice.py --data #19

Closed mccc closed 11 years ago

mccc commented 11 years ago

I've noticed Derek doesn't get these, and don't know if it's a MacPorts vs. Homebrew Postgres 9.2 thing, or some other difference with his database:

mcc:~/src/edifice$ python2.7 ./setup_edifice.py --data
Importing datasets from open data portals. this will take a while...
downloads/Building Footprints.zip exists, skipping download
extracting downloads/Building Footprints.zip
Importing  import/Buildings.shp
shp2pgsql -d -s 3435 import/Buildings.shp -g the_geom -I -W LATIN1 | psql -q -U edifice -d edifice
Shapefile type: Polygon
Postgis type: MULTIPOLYGON[2]
ERROR:  column not found in geometry_columns table
CONTEXT:  SQL statement "SELECT DropGeometryColumn('',$1,$2,$3)"
PL/pgSQL function dropgeometrycolumn(character varying,character varying,character varying) line 5 at SQL statement
ERROR:  table "-g" does not exist
NOTICE:  CREATE TABLE will create implicit sequence "-g_gid_seq" for serial column "-g.gid"
NOTICE:  ALTER TABLE / ADD PRIMARY KEY will create implicit index "-g_pkey" for table "-g"

Obviously something's pretty wrong here. Oddly, this doesn't cause Postgres to quit, it seems to keep chugging along adding data somehow. This is on Postgres9.2 with PostGIS 2.x so I am a little perplexed as to how the command line options for shp2pgsql (on my machine: /opt/local/lib/postgresql92/bin/shp2pgsql ) could be messed up, but they clearly are.

If someone else installs Postgres9.2/PostGIS via homebrew from scratch, I'd love to know if you have the same problem. We could just write off MacPorts as not usable if the differences in installs lead to too many bugs.

mccc commented 11 years ago

So the "ERROR: table "-g" does not exist" error was a problem with the construction of the string wrt encoding, now fixed in master. I'm still getting the "ERROR: column not found in geometry_columns table" and related errors though, which is seemingly caused by this line

SELECT DropGeometryColumn('','buildings','the_geom');

So maybe the error is unavoidable, due to the 'buildings' table not existing yet? It seems that way. Going to close for now.