#17107: Geodjango Tutorial: SRID problem when loading data from shapefile to
PostGIS
---------------------------------+--------------------------------------
     Reporter:  pauline.emery@…  |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  GIS              |                  Version:  1.3
     Severity:  Normal           |               Resolution:
     Keywords:  SRID problem     |             Triage Stage:  Unreviewed
    Has patch:  1                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------

Old description:

> 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.4
>
> Thank you for your time and your help

New description:

 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.4

 Thank you for your time and your help

--

Comment (by aaugustin):

 Fixed formatting.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17107#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to