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 several shp files which are the components (or tiles) of a map, I have joint all these tiles together to have a large shp file. Then I realized some of the polygon is now splitted into 2 halves, as the upper part belngs to a tile, while the lower part belongs to another tile.

This output disturb me a lot as I need to fill some polygon, but not part of the "splitted polygon", so I need to find a way to merge these splitted polygon back to one (preferrably mechanical way, as I have 10000+ polygons, not knowing which are splitted, which are not).

I need to know if the two or more polygons orginate from the larger polygon. And I think I can some how use union and spRbind to create an algorithm for this task. But I doubt if I am really the first one who encounter this problem, so I wonder if there is any existing tool in R that can solve this problem.

Thanks.

share|improve this question
    
Do you have some sample data you could post? What do you mean by 'not knowing which are split' - is there no ID column that could be used to join as @yellowcap suggests? –  Simbamangu Mar 20 '12 at 12:11

1 Answer 1

up vote 3 down vote accepted

I can only provide a partial answer to your question.

There is a function in the maptools R package called unionSpatialPolygons, see here for a manual.

The function expects an ID field, and all polygons with the same ID value will be merged. If you have an ID that identifies your polygons to be dissolved, use it. Otherwise you could try something like

unifiedPolygons <- unionSpatialPolygons(myPolygons, rep(1, length(myPolygons))

but that will probably also dissolve all other polygons that touch within you area.

share|improve this answer

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.