How i can do a shape merge?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How i can do a shape merge?

fe.gimeno
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

--
*Fernando J. Gimeno Molina*
*Licenciado en Geografía, Universidad de Chile*
*Geógrafo, Universidad de Chile*
*Estudiante Magister en Gestión y Planificación Ambiental, Universidad de
Chile*
*Diploma en Geomática Aplicada, Universidad de Chile*

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: How i can do a shape merge?

Alex Mandel-2
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

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo