[Django] #22041: LayerMapError: Django cannot import shapefile into postgresql

1 view
Skip to first unread message

Django

unread,
Feb 13, 2014, 8:45:16 PM2/13/14
to django-...@googlegroups.com
#22041: LayerMapError: Django cannot import shapefile into postgresql
-------------------------------+--------------------
Reporter: klopycira | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I am working on a web-based gis project using geodjango under django 1.6
framework. . I have using postgresql 9.1 and python 2.7
while following the tutorial on installing and making first apps in
django, i have worked on the sample (world, as presented in tutorial) and
it worked properly. As soon as i have created my own apps using
srid=32651, I have this error:

LayerMapError: Could not retrieve geometry from feature

below are my codes, and i don't know i got my mistake. .
thanks in advance for helping out. .
cheers!

models.py
{{{
from django.db import models
from django.contrib.gis.db import models as gismodels


class Butuan_Parcel(gismodels.Model):
newpin = models.CharField(max_length=35)
geometry = gismodels.MultiPolygonField(srid=32651)
objects = gismodels.GeoManager()

def __unicode__(self):
return self.newpin
# Create your models here.

}}}


settings.py
{{{
import os
from django.contrib.gis.utils import LayerMapping
from models import Butuan_Parcel

bound_mapping = {
'newpin': 'NEWPIN',
'geometry': 'MULTIPOLYGON',
}

bound_shp =
os.path.abspath(os.path.join(os.path.dirname(__file__),'data/parcels.shp'))

def run(verbose=True):
lm = LayerMapping(Butuan_Parcel, bound_shp, bound_mapping,
transform=False, encoding='iso-8859-1')
lm.save(strict=True, verbose=verbose)

}}}


load.py
{{{
import os
from django.contrib.gis.utils import LayerMapping
from models import Butuan_Parcel

bound_mapping = {
'newpin': 'NEWPIN',
'geometry': 'MULTIPOLYGON',
}

bound_shp =
os.path.abspath(os.path.join(os.path.dirname(__file__),'data/parcels.shp'))

def run(verbose=True):
lm = LayerMapping(Butuan_Parcel, bound_shp, bound_mapping,
transform=False, encoding='iso-8859-1')
lm.save(strict=True, verbose=verbose)

}}}

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

Django

unread,
Feb 14, 2014, 1:59:00 PM2/14/14
to django-...@googlegroups.com
#22041: LayerMapError: Django cannot import shapefile into postgresql
-------------------------------+--------------------------------------
Reporter: klopycira | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 1.6
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by claudep):

* status: new => closed
* needs_better_patch: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_docs: => 0


Comment:

This tracker is not meant as a support channel, please write to the
GeoDjango mailing list for support.
https://groups.google.com/forum/#!forum/geodjango

--
Ticket URL: <https://code.djangoproject.com/ticket/22041#comment:1>

Reply all
Reply to author
Forward
0 new messages