It looks like the utils module was recently changed a bit in django.contrib.gis.
Here's what I changed to make load_data.py work:
[allan@petrof geographic_admin]$ svn diff load_data.py
Index: load_data.py
--- load_data.py (revision 60) +++ load_data.py (working copy) @@ -11,7 +11,9 @@ import os os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
-from django.contrib.gis.utils import mapping, LayerMapping, add_postgis_srs +from django.contrib.gis.utils.ogrinspect import mapping +from django.contrib.gis.utils.layermapping import LayerMapping +from django.contrib.gis.utils.srs import add_postgis_srs from world.models import WorldBorders
add_postgis_srs(900913)
Comment #1
Posted on Sep 1, 2008 by Quick Hippoarcato.us,
Thanks for the report.
Can you cite a specific changeset in django.contrib.gis? Maybe you are seeing the impact of http://code.djangoproject.com/changeset/7570 where the
add_postgis_srs function was wrapped in a HAS_GDAL try statement? Essentially, the idea is these utilities depend on GDAL being installed and thus should be
imported from django.contrib.gis.utils
rather than they way you have patched the file (to import directly from the modules rather than the init.py)
Maybe if you paste the error you were getting I might see something I'm missing.
But, AFAICT importing from the init is the right approach. See: http://code.djangoproject.com/browser/django/trunk/django/contrib/gis/utils/init.py
Comment #2
Posted on Sep 6, 2008 by Helpful GiraffeOkay, the original load_data script is indeed working for me now. It looks like my GDAL configuration was messed up during my first attempt....
Comment #3
Posted on Sep 9, 2008 by Quick HippoOkay, I'll close this issue then (since the problem was your GDAL installation not this app code).
Arcato.us, you could consider filing a ticket on the django trac site for more explicit error reporting for when GDAL is not found here:
http://code.djangoproject.com/browser/django/trunk/django/contrib/gis/utils/init.py
... instead of just pass
.
Comment #4
Posted on Sep 9, 2008 by Quick Hippo(No comment was entered for this change.)
Status: Invalid
Labels:
Type-Other
Priority-Medium