minus34 / gnaf-loader

A quick way to get started with Geoscape's open GNAF & Admin Boundaries
Apache License 2.0
185 stars 66 forks source link

Fails at Part 2 OF 4 - Not finding/creating boundary layers #13

Closed simongis closed 8 years ago

simongis commented 8 years ago

Postgres 9.5.3, PostGIS 2.2.2 Anaconda 2.4.1 (32-bit) - Python 2.7.12 psycopg2-win-py27 - 2.6.1 All installed on a Windows 10 local machine.

Created an empty database in postgres called _gnafMay16 1

Have downloaded the May 2016 GNAF and the Admin boundaries paths

Only modifications made to load-gnaf.py are to hard-code in my PGDATABASE, PGUSER, PGPASSWORD details.

Running load-gnaf.py with the following parameters: python load-gnaf.py --gnaf-tables-path="D:\DemoFolder\G-NAF\Downloads\MAY16_GNAF_PipeSeparatedValue_20160523140820\G-NAF\G-NAF MAY 2016" --admin-bdys-path="D:\DemoFolder\G-NAF\Downloads" --states TAS ACT

Fails at Part 2 OF 4.

relation "raw_admin_bdys.aus_state" does NOT exist
LINE 12:   FROM raw_admin_bdys.aus_state AS tab

Full log here.

Database after failing: 2

So looks like its failing to create any boundary files.

"--admin-bdys-path = This path should contain a subfolder named Administrative Boundaries." I fed in the argument for this to point to D:\DemoFolder\G-NAF\Downloads, which has a sub folder called Administrative Boundaries, which then has the various subfolders for each type, and these then have subfolders for Authority Code and Standard, as downloaded from data.gov.au.

I am a complete noob with PostGIS and also Python, but im guessing I have made a basic rookie error somewhere. I know I can use the dump files you provide, but would like to get this working so I can get a better understanding of how it all works. Care to put me out of my misery?

keithamoss commented 8 years ago

I can't reproduce this exactly, but gut feeling says it may relate to the hard-coding of the PG connection details.

What happens if you re-run and pass them in via the available parameters? e.g.

python load-gnaf.py --gnaf-tables-path="D:\DemoFolder\G-NAF\Downloads\MAY16_GNAF_PipeSeparatedValue_20160523140820\G-NAF\G-NAF MAY 2016" --admin-bdys-path="D:\DemoFolder\G-NAF\Downloads" --states TAS ACT --pgdb="DATABASE" --pguser="USER" --pgpassword="PASSWORD"

Edit #1 -

If that doesn't help comment out these two lines, which will give you the psql commands for loading the admin boundaries tables. Try running one of them by hand and see what errors result :)

Edit #2 -

If you get past this there's a fun extra bug awaiting you. If you pass --states TAS ACT you'll get a bunch of errors relating to the lack of admin_bdys.local_government_wards and raw_admin_bdys.aus_ward tables.

temasso commented 8 years ago

Make sure you have PostgreSQL bin directory in your PATH. For test type shp2pgsql or psql in command line (these bins are used in part 2).

simongis commented 8 years ago

Thanks for responding, just gotten around to looking at this again.

Make sure you have PostgreSQL bin directory in your PATH.

I was missing this (rookie error). Have updated and can run both shp2pgsql & psql from a CMD. However, script still fails with similar errors for just Tas, might be related to the Edit#2 mentioned above.

Bingo! Seems to have completed if I just process VIC. Let me try for all States and ill report back after the weekend with the log.

simongis commented 8 years ago

Monday morning and looks like the script has completed successfully. Here is the output from the CMD prompt - pastebin

Unless you can spot something that looks out of place, I believe this issue can be closed off.

1

minus34 commented 8 years ago

Looks good! Have added a note to the readme to add the Postgres bin folder to system path as part of your setup.

Keith - please log the Wards issue for follow up. Not sure I'll get to it before GovHack though!

simongis commented 8 years ago

Thanks all. BTW, @keithamoss im working on incorporating this script (thanks @minus34) into a bigger automated workflow where I can create an Esri Address Locator from the data for the purpose of serving up to ArcGIS Server so you can register it with your portal. Once I have sussed out the address locator styles, ill let you know if you want a copy?

minus34 commented 8 years ago

No probs! Good stuff with the Locator work!