Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using geodjango and postgis (1.x),
What is the best way to combine (union) a list of multipolygons.

in what i assume is rather inefficient i'm looping trough like this

combined = multipolygon

for item in items:

____combined = combined.union(item.geom)  #geom is a multipolygon

Usually this works fine, but often i'm getting the error Error encountered checking Geometry returned from GEOS C function "GEOSUnion_r".

Here is the geo json version of the item the error is thrown on if it helps

{ "type": "MultiPolygon", "coordinates": 
[ [ [ [ -80.077576, 26.572225 ], 
      [ -80.037729, 26.571180 ], 
      [ -80.080279, 26.273744 ], 
      [ -80.147464, 26.310066 ], 
      [ -80.152851, 26.455851 ], 
      [ -80.138560, 26.538013 ], 
      [ -80.077576, 26.572225 ] 
] ] ] 

does anyone have anyideas? the end goal is to take find all the locations (another table) which fall within this list of n polygons (using coordinates__within=combined_area)

thanks in advance for any help.

share|improve this question
Also, the polygons all show up fine in the django admin. – kennethj Mar 20 '13 at 3:54
I found a work around, posted over here… – kennethj Mar 21 '13 at 2:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.