FAQ
Dear all,

I'm working with a SpatialPolygonsDataFrame, with 176 rows. This is a subset of an RData file downloaded from http://www.gadm.org/country

One row corresponds to the main part of the Indian subdistrict Hubli which you can see here: http://www.dharwad.nic.in/dist_dwd.htm. Currently, a *separate* row in the SpatialPolygonsDataFrame corresponds to the smaller part of the same subdistrict, which as you can see is not contiguous with the larger part of the subdistrict.

If possible, I'd like to merge the two rows, so that a single row in the SpatialPolygonsDataFrame corresponds to *both* parts of Hubli subregion (and the polygons slot for this row describes both parts of the subdistrict, recognising that they are not contiguous). Is this possible?

My impression is that unionSpatialPolygons might be the function I need, but I haven't been able to figure out the right syntax, and haven't had any luck searching this list's archives. From the help page, I thought that I might need something like:

reg <- 1:dim(karnat)[1] # karnat is my SpatialPolygonsDataFrame
reg[78] < reg[75]
karnat2 <- unionSpatialPolygons(karnat, reg) # an attempt to merge or combine rows 75 and 78

But this isn't working at all, and I'm a bit stuck. If you can see what I'm trying to do, can anyone suggest the syntax I want?

Any help would be much appreciated.

- Malcolm


Dr Malcolm Fairbrother
Lecturer
School of Geographical Sciences
University of Bristol

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupr-sig-geo @
categoriesr
postedOct 22, '10 at 5:26p
activeOct 22, '10 at 7:01p
posts2
users2
websiter-project.org
irc#r

People

Translate

site design / logo © 2022 Grokbase