vpistis / geodjango-basic-apps

Automatically exported from code.google.com/p/geodjango-basic-apps
0 stars 0 forks source link

load_data.py fails with latest django trunk #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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)

Original issue reported on code.google.com by arcato...@gmail.com on 1 Sep 2008 at 3:59

GoogleCodeExporter commented 8 years ago
arcato.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/__in
it__.py

Original comment by dane.spr...@gmail.com on 1 Sep 2008 at 9:45

GoogleCodeExporter commented 8 years ago
Okay, the original load_data script is indeed working for me now.  It looks 
like my
GDAL configuration was messed up during my first attempt....

Original comment by arcato...@gmail.com on 6 Sep 2008 at 9:43

GoogleCodeExporter commented 8 years ago
Okay, 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/__in
it__.py

... instead of just `pass`.

Original comment by dane.spr...@gmail.com on 9 Sep 2008 at 12:49

GoogleCodeExporter commented 8 years ago

Original comment by dane.spr...@gmail.com on 9 Sep 2008 at 12:50