[R-sig-Geo] How i can do a shape merge?
Alex M
tech_dev @end|ng |rom w||d|nte||ect@com
Fri Feb 1 18:50:19 CET 2019
On 2/1/19 07:11, Fernando Gimeno wrote:
> Hello
>
> I'm looking a method with the same result that Arcgis "merge"
>
> I have to do a shape merge with a lot of archives but most common tools on
> R has not merged alll shape and always i have to export to arcgis. Has
> anyone worked this?
>
> Thank you
>
With sp type layers, use bind from the raster package, to do many layers
you use do.call with it.
https://rspatial.org/spatial/7-vectmanip.html#append
do.call(bind, listoflayers)
With sf you can use rbind, though if you have a lot of data you might
want to use data.table and noted in this discussion.
https://github.com/r-spatial/sf/issues/798
do.call(rbind, listoflayers)
But really if you have a lot of layers, loading them into memory in R
before combining is not particularly efficient. Consider using
commandline: ogr2ogr -append
https://www.gdal.org/ogr2ogr.html
You can call ogr2ogr from R with the gdalUtils package.
Enjoy,
Alex
More information about the R-sig-Geo
mailing list