Monthly Archives: May 2010

Programming Library – “Pro Iron Python “

As the occasional reader of my ramblings may have noticed by now, I’m a bookish kind of guy. I learn best by reading a chapter at a time, then going back to the web and filling in the blanks or trying stuff out on the computer.

The Iron Python Cook Book is a good place to start. But if you’re interested in a book, I recommend “Pro Iron Python” (Apress). I originally ordered Iron Python in Action from But that turned out to be more of a book by developers for developers, not what I need – a book by a friednly pro written for beginners. “Pro Iron Python is that kind of book. In fact, it probably works well together with my other purchase, Beginning C# (also Apress).

Anyway, just thought I’d mention that if you’re looking for a gentle introduction, I highly recommend the former over that latter.

Leave a comment

Filed under Uncategorized

What about ArcPy ?

I am a little curious about ArcPy, the new Python site-package that comes with ArcGIS 10, which as far as I know will ship next month. Will ArcPy be a major change or merely another label for the capabilities of the old arcgisscripting ?

import arcpy     instead of     import arcgisscripting ?

There are some new features and modules but nothing fancy. Wow, they’re moving to Python 2.6. What about 3.1? Over all, little reason to think that my hopes for Python as the ArcGIS super-glue language are about to come true. The mention of Iron Python here got me excited but … we’ll have to wait for ArcGIS15.

Leave a comment

Filed under Uncategorized

Great Python/Django Blog – “Salty Crane”

I stumbled upon this blog today and found some really interesting posts. Much of it way over my GIS head, some of if really useful. Check it out:

Leave a comment

Filed under Uncategorized

Geodjango – The Sequel…

During Week 2 of working with the Geodjango tutorial, I was having more luck. I corrected some mistakes I made earlier. The module mentioned in (7) – see last post – obviously has to be the I also re-ran the Windows installer for Geodjango to improve my directory structure. Somehow I had two Django versions installed, and my PYTHONPATH was a little cluttered. It seemed that everything was working great.

Then, I got to the 

But when I got to the “Google / Geographic Admin” section of the tutorial I was unable to display the WorldBorders entries on a map. I can pull up http://localhost:800/admin in my browser, and I get this screen:

But none of the links seem to work. If I click on ‘World borderss’ (sic!), I see /world/worldborders’ appended in the address bar of the browser. But nothing else happens. Did I mess up somewhere, e.g. when I snuck in the the typo “World borderss” ? Where do I need to fix that ? Or is this a problem with ? Any help is appreciated.

Hmm. Maybe it’s time to start over. Each time I do, I seem to learn something new and catch another glitch.

Leave a comment

Filed under Uncategorized

Geodjango Install on Windows Vista… what I’ve learned so far

It’s been a while since I installed Django on my Ubuntu laptop, and while my memory may betray me, I didn’t seem to be having too much trouble at the time. Having intensified my Python efforts lately, I thought I’d get Geodjango up and running on my Windows machine.

It’s been quite a trip, with too many starts and stops to count. I haven’t completely finished but a few lessons learned should be noted here before I forget. Plus someone else might find them helpful.

1) Essentially, I followed the instructions here (the for installation of Geodjango on Windows. The order of installation (whether required or merely advantageous) here was Python2.6 >> Postgresql8.3 >> Postgis1.3.6 >> Psycopg2 >> Geodjango, and I kept it that way. I already had Python installed, and didn’t re-install (more about that later…) I especially liked that the Geodjango installer takes care of all kinds of other nefarious installs for you (GDAL, PROJ4).

2) If you’re new to Postgres, which essentially I was/am, then it helps to know a bit about its database users. If you’re working on a desktop that’s not part of some *real* domain (like me, me@mycomputer), you’re most likely (able to become) the Administrator of your machine.  Run the postgres installer (exe/msi) as administrator, and follow the steps. When you’re prompted for a user name and password during the Postgres installation, go with the default ‘postgres’ and pick a password. Although you’re the one installing the software, you’re not automatically a user with permission to use the software (see item 4).

3) If you’re like me and you have more than one version of Python (e.g. 2.4, 2.5, 2.6, and 3.1) installed, make sure that Psycopg installs in the correct directory, i.e. the one for the version you’re going to be using with Django, in this case 2.6. Also your Windows PATH should include ‘c:\python26’, and I’m thinking that to avoid headaches, it should be listed in front c:\python25 and any other versions. More than likely, you’ll be having some issues with the paths.

To get to the Windows PATH, go to Control Panel .. System…Advanced… Environment Variables…PATH

To change Python’s search path for modules (sys.path, which is Python list):

import sys
print sys.path # This will allow you to look at the path

sys.path.append(‘your_mew_entry’) # to add items

4) Once everything was installed, I switched to these instructions of the  Geodjango Tutorial for configurations and setup. Once you’re ready to create a Postgres database, I think (and correct me if I’m wrong) it really doesn’t matter where you install your database. You initiate it with:

initdb -D <directory>

then you need to ‘become’ the postgres user ‘postgres’ to create it, use:

-U <yourname>, as in createdb -U <yourname> <yourproject> -T template_postgis geodjango

5) There is a good chance that you are much smarter than me or have more experience with Postgres and the Geodjango installation. But then, you probably wouldn’t be reading this. So, here is some more help. – If something fails in your initial Postgres install/setup, you will have to re-install. In that case, uninstall the program, delete the database folder, and then to delete the ‘postgres’ user you’ve created (and which Windows somehow doesn’t list under Users) do this:

net user <user> \delete

 Then you can start over.

6) When you’re Creating your Geodjango project, you might notice that the you installed looks different from the one in the tutorial.

    ‘default’: {
        ‘NAME’: ‘test_db’,
        ‘ENGINE’: ‘django.db.backends.postgresql_psycopg2’,
        ‘USER’: ‘myusername’,
        ‘PASSWORD’: ‘s3krit’,

instead of the following.

DATABASE_NAME = ‘geodjango’
DATABASE_ENGINE = ‘postgresql_psycopg2’
DATABASE_USER = ‘postgres’

Apparently, the former was version 1.1, the latter is version 1.2. I’m thinking (hoping) that merely replacing one with the other will do the trick. Can’t confirm this yet.

7) When it comes to Defining a Geographic Model, I copy/pasted the code from the tutorial into notepad, but then wasn’t sure what to save it as. The command python sqlall world, seems to imply it needs to be called Also, the module defines a class world_borders, and you should be expecting as outout something like “… world_worldborders…”. Anyway, this is how far I’ve gotten today. I am shooting for a clean, more successful run next time.

Leave a comment

Filed under Uncategorized

“Building Skills in Python” – Steven F. Lott

Building Skills in Python might just be the single best introduction to Python I have come across. It’s straightforward, lacks all the redundancy of typical IT books, it’s no-nonsense ( I don’t like to learn by cringing at silly jokes ), it’s unusually comprehensive by addressing the realities of multiple operating systems, and it’s a free to download here.

Leave a comment

Filed under Uncategorized