0

I do not know how to regroup polygons from SpatialPolygons list in the following manner:

I have object rtu:

> rtu
class       : SpatialPolygons 
features    : 81 
extent      : 450685, 458760, 358519, 364860  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs 

And I can extract groups of lists using some solved index. Here p=c(53,55) Now using:

> rtu[p]
class       : SpatialPolygons 
features    : 2 
extent      : 456893, 457240, 362763, 363909  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs 

I have my group of 2 lists but I need to merge it into one and take all polygons together. These are their lengths:

> length(rtu@polygons[[p[2]]]@Polygons)
[1] 162
> length(rtu@polygons[[p[1]]]@Polygons)
[1] 2

How do I get one list of 164 polygons?

I am trying rbind, bind but still get this separation of 2 lists. I mean it should look like

> p
class       : SpatialPolygons 
features    : 1
...

and have 1 list of 164 polygons.

  • do.call with rbind ie., do.call("rbind", mylist) – Jeffrey Evans Jun 21 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.