Error when importing into GeoDjango
Home › Forums › Natural Earth Map Data › Cultural Vectors › Admin 1 – States, Provinces and their Boundaries › Error when importing into GeoDjango
- This topic has 8 replies, 1 voice, and was last updated 16 years, 4 months ago by
Nathaniel.
-
AuthorPosts
-
December 9, 2009 at 5:38 pm #3933
NathanielKeymaster@ Philipp: I’ve since run a “Repair Geometry” routine on the admin-1 that should remove some of these errors. You can find that beta file here:
http://www.nacis.org/naturalearth/temp/10m_admin_1_version1b1.zip
Let me know if this new file imports for you.
_Nathaniel
December 10, 2009 at 8:10 am #3934
scalarParticipantthanks for the help, it worked now.
I posted the first part of my work here:
http://github.com/philippWassibauer/django-natural-earth
I hope other people are interested too who will help me keeping this up to date.
I would also like to incorporate Geoname Data. Eg.: I would need altitude numbers globally. Are you going to incorporate geoname data into your DB or should I create an app that imports data from both sources?
Thanks,
Philipp Wassibauer
December 10, 2009 at 3:58 pm #3935
NathanielKeymaster@ Philipp: Yes, I would like to incorporate GeoNames feature IDs on all Natural Earth features. Yes, please try creating an app that imports from both sources! Preserve the original NE feature IDs so we can bring your linkages back into the main data branch. I’ve also reached out to Yahoo! GeoID folks, I’d like to get both, will do wonders for semantic web. I’m also curious about GeoNames as they seem to link to Wikipedia. Is that hard coded or softcoded in their DB? Might be nice to get that as well as the GeoNames ID.
Please describe more: I would need altitude numbers globally. Do you mean elevations above sea level or something else? Is this important for matching with GeoNames? Thanks!
December 10, 2009 at 3:59 pm #3936
NathanielKeymasterAlso, by mid January I should have cleaned the geometry on several of the other polygons files in Natural Earth so it’s easier to import into GeoDjango and other more strict geo database apps.
December 20, 2009 at 10:53 pm #3937
dhiltonParticipantI tried using the amended data but to no avail.
I got the following error on django 1.1.1:
./manage.py ne_import_countries ./data/10m_admin_1_version1b1.shp
Datasource has 1 layers
Importing Layer 10m_admin_1_version1b1 of type Polygon, size: 3786
Traceback (most recent call last):
File "./manage.py", line 16, in <module>
execute_manager(settings)
File "/var/www/python/mapy/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/core/management/__init__.py", line 362, in execute_manager
utility.execute()
File "/var/www/python/mapy/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/core/management/__init__.py", line 303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/var/www/python/mapy/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/core/management/base.py", line 195, in run_from_argv
self.execute(*args, **options.__dict__)
File "/var/www/python/mapy/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/core/management/base.py", line 222, in execute
output = self.handle(*args, **options)
File "/var/www/python/mapy/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/core/management/base.py", line 322, in handle
label_output = self.handle_label(label, **options)
File "./django-natural-earth/natural_earth/management/commands/ne_import_countries.py", line 35, in handle_label
transform=False, encoding='iso-8859-1')
File "/var/www/python/mapy/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/contrib/gis/utils/layermapping.py", line 187, in __init__
self.check_layer()
File "/var/www/python/mapy/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/contrib/gis/utils/layermapping.py", line 319, in check_layer
idx = check_ogr_fld(ogr_name)
File "/var/www/python/mapy/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/contrib/gis/utils/layermapping.py", line 265, in check_ogr_fld
raise LayerMapError('Given mapping OGR field "%s" not found in OGR Layer.' % ogr_map_fld)
django.contrib.gis.utils.layermapping.LayerMapError: Given mapping OGR field "SHAPE_AREA" not found in OGR Layer.December 20, 2009 at 11:48 pm #3938
NathanielKeymasterDo other layers like the rivers import for you? I don’t have any experience with GeoDjango

The admin_0 and admin_1 are tough eggs to crack. The topology is a little messy right now. We hope to have that fixed in January.
December 30, 2009 at 12:46 am #3939
dhiltonParticipantIt’s not so much a geodjango issue as it is a PostGIS / property issue. The django app uses a specfic mapping of shapefile properties to internal database columns; change the fields and the db schema and it will load the data fine. The problem comes when you try and use the data in a meaningful way. I’ve used ogrinfo and qGis to inspect the properties of the shapefile but can’t seem to find much to help me. At the moment the app loads all of the counties but they’re not within their countries nor have their administrative names attached to them. Any ideas or pointers about where I can learn more about this so I can help?
December 30, 2009 at 1:21 am #3940
NathanielKeymasterFor the admin-0 the columns with the administrative names of the countries are in the Subunit, MapUnit, Country, and Sov columns. Do those load into your system? A forthcoming update will include more thematic data for each admin-0 feature.
-
AuthorPosts
You must be logged in to reply to this topic.













