cannot set GeometryProxy with value of type

1,391 views
Skip to first unread message

Antony

unread,
Dec 14, 2011, 9:50:01 AM12/14/11
to Django users
Hi,

I am simply trying the following,

outerWallPolygon = SpatialFeatures.objects.all()
print "outerWallPolygon: ",outerWallPolygon[0].geometry

and get this error.
cannot set GeometryProxy with value of type: <class
'django.contrib.gis.geos.collections.MultiPolygon'>

I believe I have everything set up correctly, the Geomanager, the GIS
libraries in my settings.py etc.
Let me know if you need me to provide any further info. I have seen
some coding around like here,
http://spygit.durden.webfactional.com/django/bf7b51452973fcca489b5734e9be0c8acda08133/django/contrib/gis/db/models/proxy.py/
but i am not sure if I am supposed to use this or not and how?

Anyway, any help would be appreciated!

Thanks in advance!

Ryan H.

unread,
Jan 17, 2012, 12:49:54 PM1/17/12
to Django users
Hi Antony,

I don't know if you've already gotten your answer (hopefully), but if
not, I can share my notes on what I did to solve the problem when I
saw the same error:

First, check the spatial data in your database. There should be a
column called "type" with an entry for each geometry. I'm betting
some (if not all) will read "MULTIPOLYGON".

Next, check your model definition for "SpatialFeatures". Make sure
that you've set "geometry = MultiPolygonField(..." or at least that
the field type here matches the geometry type of the features stored
in your database.

Hope this helps,
~Ryan

On Dec 14 2011, 6:50 am, Antony <antchrysoch...@googlemail.com> wrote:
> Hi,
>
> I am simply trying the following,
>
> outerWallPolygon = SpatialFeatures.objects.all()
> print "outerWallPolygon: ",outerWallPolygon[0].geometry
>
> and get this error.
> cannot set  GeometryProxywith value of type: <class
> 'django.contrib.gis.geos.collections.MultiPolygon'>
>
> I believe I have everything set up correctly, the Geomanager, the GIS
> libraries in my settings.py etc.
> Let me know if you need me to provide any further info. I have seen
> some coding around like here,http://spygit.durden.webfactional.com/django/bf7b51452973fcca489b5734...
Reply all
Reply to author
Forward
0 new messages