Opened 16 years ago

Last modified 16 years ago

#8881 closed

LayerMapping Error with more than two fields geometry — at Initial Version

Reported by: woakas@… Owned by: nobody
Component: GIS Version: 1.0-beta
Severity: Keywords: gis layermapping
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If my models have a two o more fields of type geometry:
class Lugares(models.Model) :

nombre = models.CharField(max_length=80)
punto = models.MultiPointField(null=True, blank=True, srid=4326)
poligono = models.MultiPolygonField(null=True, blank=True, srid=4326)
objects =models.GeoManager()

lm=LayerMapping(Lugares,'/home/woakas/nuevo.shp', mapping,unique={'poligono':'POLYGON','tipolugar':'Ciudad'})


LayerMapError Traceback (most recent call last)

/home/woakas/mig/Migtrace/trunk/src/<ipython console> in <module>()

/usr/lib/python2.5/site-packages/django/contrib/gis/utils/layermapping.py in init(self, model, data, mapping, layer, source_srs, encoding, transaction_mode, transform, unique)

186 # geometry column).
187 self.model = model

--> 188 self.geo_col = self.geometry_column()

189
190 # Checking the source spatial reference system, and getting

/usr/lib/python2.5/site-packages/django/contrib/gis/utils/layermapping.py in geometry_column(self)

516 return GeometryColumns.objects.get(gc_kwargs)
517 except Exception, msg:

--> 518 raise LayerMapError('Geometry column does not exist for model. (did you run syncdb?):\n %s' % msg)

519
520 def make_multi(self, geom_type, model_field):

LayerMapError: Geometry column does not exist for model. (did you run syncdb?):

get() returned more than one GeometryColumns -- it returned 2! Lookup parameters were {'f_table_name': 'migtrace_lugares'}

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top