Archive for the ‘ PostGIS ’ Category

PostGIS & Qgis updated on Arch

PostGIS 1.5.3 has been recompiled for the Arch package repository, it now works out of the box with Postgres 9.1.

QGIS 1.7.1 has been added to AUR, but it is not compiling correctly for me.  It tried adding a flag to the PGKBUILD file that specified where the Python 2 libraries were held, but the compile still bombed out.  There are a few more tricks to try, hopefully I’ll stumble upon the right combination.  If I do maybe I’ll submit my first PGKBUILD to AUR.

Well, that was quick

Compile from source, problem solved.  Plus now I’ve got the shp2pgsql GUI to play with.  Huzzah!

I should have used the silent option when restoring the database dump.  2 GB worth of insert successful messages take forever to scroll by.

Upgraded Postgres, borked PostGIS

Oops.  Postgres 9.1 hit the Arch repositories a few weeks ago, and I finally decided to run the upgrade.  I dumped all my databases, ran the upgrade, and re-imported the dumps.  Now PostGIS is totally borked, the geography datatype isn’t recognized and most of the PostGIS functions aren’t in the database.  I tried re-installing PostGIS via Pacman, but that didn’t help.  Arch’s forums and wiki are both down, I’m going to wait until they pop back up to see if there’s something I missed there.  If not, I’ll try installing PostGIS from source.

Fixed the TIGER Georeference Loader Script

PostGIS in Action has a chapter on extensions to Postgres and PostGIS that might be helpful.  The first one they cover is a georeference tool for TIGER data.  The tool generates scripts that download an entire state’s worth of data, unzips it, and loads the appropriate tables into Postgres.  The book warned that the Linux version of the script was untested.  It was more than untested, it was a disaster.

At the top of the script it sets two PATH variables, one for where the data is to be downloaded to, the other to a temporary directory where the data will be unzipped to.  The destination path is quoted, quotes aren’t necessary but they don’t break anything if they’re there.  The temporary path only had the opening quote, no closing.  That will break things.

The TIGER is organized by state on the Census’s website.  In each state directory there are zip files with state level data, and subdirectories, one for each county in the state and they all contain multiple zip files.  The script had a for loop to unzip the county level zip files, but it skipped the state level.  And the for loop’s syntax was very, very wrong.

for z in *.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done

for z in */*.zip; do $UNZIPTOOL -o -d $TMPDIR $z; done

The script only had the second statement, and it was missing the semicolons, the $z so unzip had no idea what it was supposed to unzip, and the done statement was missing.

After the data was unzipped and dumped into the temp directory shp2pgql and psql are used to dump the data into Postgres.  The first statement was missing a quote.  The psql statements were missing flags to tell it which database to use and which user was to be used to do the dumping.  The tables with county level data needed loops to run through each county’s set of data.  The loops had the wrong syntax again, they almost looked like the syntax for a Windows bat file, but even that syntax wasn’t quite right.

The book’s authors aren’t to be blamed for these errors.  The code was someone else’s and they clearly state that the linux portion of the code has not been tested or looked at.  I just wanted to document this so next time I use it I know what I did to get it working.

 

Updated PostGIS 2.0 timeframe

The PostGIS team has updated the release timeline for 2.0.  Looks like the alpha will be out Decemberish, beta in January, and the final in mid Februaryish.  Shoot.

PostGIS 2.0 almost here!

September is here and PostGIS is right around the corner!  A few weeks?  A month?  Hopefully just a few weeks, there is some TIN stuff I want to try!  It will be OSGeo nerd Christmas!  Exclamation point!

PostGIS in Action is a great book

PostGIS in Action is one of the best tech books I have ever read.  In addition to being a thorough guide inside and out to PostGIS it is also full of tips and tricks for the Postgres database itself.

My only reservation with the book is that now might not be the best time to pick up a copy.  With the big additions PostGIS 2.0 will bring soon I would be hesitant to pick up a copy until it has been updated for the new version.