Take the 2-minute tour ×
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 have a shapefile with lots of polygons and I need to union all polygons which have the same identifier-id into a new (multi-)polygon, ideally with the same identifier-id on another (new) layer.

As there are lots of polygons I don't want to do this manually. Is there a simple way I can do this automatically in QGIS? I suppose This can be done with Spatialite, but that's only a guess.

Please help a rookie. Any hints appreciated. Thank you!

share|improve this question
    
can you use postgis for this .. –  Vicky Nov 18 '11 at 12:00
    
@Darren! Thank you , it worked like a charm - just a few mouse clicks and voila the needed new shapfile is created! @Vicky! Thanks for your answer , trying to help a total rookie. unfortunatley I dont know postgis at all. I only have a basic knowledge of sqlite ( the "nonspatial" father/mother of spatiale) and thought I could do this via spatialite, which needs no server and is supported by qgis. Gorky –  user4855 Nov 18 '11 at 13:37
1  
I realize you're new to this site and thanks for posting the question; however, the posts are reserved usually for answers, any thanks or additional information could be added to the original posts. Specific comments to a post could be added under each post. Don't forget to accept an answer if it works for you, and feel free to update your question or ask the users for more clarification. Cheers :) –  dassouki Nov 18 '11 at 14:53
add comment

2 Answers

Using Postgis this can be done very easily within less time .. steps for that

  1. upload your shapefile in postgis
  2. get a list of total geometries available:
lst = some_function('select geom from tableName')
  1. iterate over table
    fetch each geometry and use:
g3 =  ST_Union(geometry g1, geometry g2);
  1. and the final geometry you got will the union of all.

I don't whether this is the Best for You.. But I would have follwed this..

share|improve this answer
add comment

Do a dissolve on the ID field.

share|improve this answer
    
A follow up question; how do you ensure that the boundaries matchup nicely after the dissolve? from experience, I find that I have to go back and remove or redissolve polygons –  dassouki Nov 18 '11 at 20:33
    
dassouki: I'm not sure I follow. If your data isn't topologically clean before the dissolve, it won't be after either. If it is clean before the dissolve, it should be after! I guess the answer is to use clean data, or to clean it before doing a dissolve if it's not already :) –  Darren Cope Nov 25 '11 at 19:39
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.