[R-sig-Geo] How to crop a shapefile ?

Dylan Beaudette debeaudette at ucdavis.edu
Thu Dec 17 19:27:41 CET 2009


> On Thu, 2009-12-17 at 11:07 +0100, Baptiste Coulmont wrote:
> > Hi,
> >
> > I'm working with R and various shapefiles created by the OpenStreetMap
> > project. Those shapefiles (the roads in particular) are quite big.
> >
> > How can I crop (or "trim", or "prune" those objects -- once in a
> > SpatialLineDataFrame -- if I need to work not on a national level but
> > on a municipal level ?
> >
> > Is it possible to create a subset of a smaller zone ?
> > Coordinates:
> >          min       max
> > r1  2.560776  6.403847
> > r2 49.493613 51.505419
> >
> > Thansk,
> > B. Coulmont

This type of work is most efficiently done in a standard GIS. I would suggest 
installing GRASS GIS or something like that. This is a standard vector 
operation, and should be very fast. For this GRASS approach, see the 
v.overlay command.

Cheers,
Dylan



-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341



More information about the R-sig-Geo mailing list