Alfonso,

Yes, polygon data stored as multipolygons will play nice at the
database level. This is a common approach with shapefiles imported
into Postgres/Postgis that contain both single and multi geometries.
You therefore just assume they are all multipolygons (ie like
shp2pgsql). You just need to be aware that GeoDjango will no longer
enforce single polygon validation when data is input (which it sounds
like you'll be fine without since you've got some true multipolygons
in your data).

You may run into some analytical challenges down the road if you need
to do queries or processing where multigeometries should be handled
differently that single geometries, but that sounds beyond your basic
import question, so I'd have to know more about your application to
comment.

Note: you can't just switch the field type on the fly: If you switch
your model field type to a MultiPolygonField you will need to run
syncdb again so the correct postgis geometry_columns entry is created
with type MULTIPOLYGON.

Then go ahead and import your shapefile data with the LayerMapping
utility of contrib.gis and specific `multi_geom=True` as a keyword
argument. See line 24 of:
http://code.google.com/p/geodjango-basic-apps/source/browse/trunk/projects/geographic_admin/load_data.py#24
as an example.

Cheers,

Dane

On Sep 18, 3:38 pm, Alfonso <[EMAIL PROTECTED]> wrote:
> I've got a nice chunk of shapefile data to import into a GeoDjango DB
> via LayerMapping and have discovered only one of the entries is a
> MultiPolygon shape - the rest Polygon.  My question is this... if I
> change the model definition for the corresponding polygon field from
> PolygonField to MultiPolygonField, will that have any affect on non-
> multipolygon data - i.e. will MultiPolygon play nice with
> 'PolygonField' data?
>
> I think I almost managed to confuse myself there!!  Any help would be
> appreciated, hope that makes sense!
>
> Allan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to