On Monday, October 17, 2011 5:06:39 PM UTC-4, Pauline Emery wrote:
Dear all,--I'm having a problem doing the section "LayerMapping" of the GeoDjango
official Tutorial [1].After creating load.py in the world directory. Leaving as specified:
"the transform keyword set to False because the data in the shapefile
does not need to be converted -- it's already in WGS84 (SRID=4326)"I execute as indicate the following commands:
$ python manage.py shell
>>> from world import load
>>> load.run()And obtain the following error:
Failed to save the feature (id: 0) into the model with the keyword arguments:
{'iso2': u'AG', 'pop2005': 83039, 'area': 44, 'region': 19, 'lon':
-61.783000000000001, 'iso3': u'ATG', 'subregion': 29, 'fips': u'AC',
'lat': 17.077999999999999, 'un': 28, 'mpoly': 'MULTIPOLYGON
(((-61.729171999999949 17.608608000000004,-61.731116999999983
17.54722200000009,-61.732779999999991 17.541111,-61.738891999999964
17.5405540000001,-61.751944999999921
...
17.644722000000115,-61.731673999999941
17.624996000000067,-61.729171999999949 17.608608000000004)))', 'name':
u'Antigua and Barbuda'}
[... stack trace]
IntegrityError: new row for relation "world_worldborder" violates
check constraint "enforce_srid_mpoly"Postgres enforcing the check constraint for SRID=4326. I don't know to
say to Django to insert explicitely the SRID into the MULTIPOLYGON
command. Inserting the line by hand on Postgres work fine using
ST_Geomfromtext( 'MULTIPOLYGON(((...) (...)),4326).
The same problem occurs with other tutorials:
GeoDjango Database API with the Zipcode model [2]
GeographicAdminQuickStart [3]I'm working with Python 2.6 / Django 1.3 with GeoDjango / GDAL 1.7.2
/ PostgreSQL 8.4.8 / PostGIS 1.5 / Pyscopg2 2.4Thank you for your time and your help,
Pauline Emery
[1] https://docs.djangoproject.
com/en/dev/ref/contrib/gis/ tutorial/
[2] https://docs.djangoproject.com/en/1.3/ref/contrib/gis/ model-api/
[3] http://code.google.com/p/geodjango-basic-apps/wiki/ GeographicAdminQuickStart
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/9UeDS5pVbeUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment