[R-sig-Geo] How to crop a shapefile ?
Renaud Lancelot
renaud.lancelot at cirad.fr
Thu Dec 17 18:47:05 CET 2009
Hi Baptiste,
I recently met a similar issue, and ended to the solution described here
(unfortunately, it's in French :-)):
ftp://ftp.cirad.fr/pub/group-r/groupe-r/Fiches/Foret.pdf
It uses point.in.polygon (package sp), and it is adapted to the special
case of the shapefile containing polygons. Perhaps you can adapt it for
polylines, possibly reversing the test (points of the lines falling into
the area of interest for you).
I would be interested to hear about any alternative / better solution.
All the best,
Renaud
Baptiste Coulmont a écrit :
> 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
>
--
Renaud Lancelot
EDEN Project, coordinator
http://www.eden-fp6project.net/
<< EDEN International Conference, Montpellier, 10-12 May 2010 >>
<< http://international-conference2010.eden-fp6project.net/ >>
UMR CIRAD-INRA "Contrôle des maladies animales exotiques et émergentes"
Joint research unit "Control of emerging and exotic animal diseases"
CIRAD, Campus International de Baillarguet TA A-DIR / B
F34398 Montpellier
http://www.cirad.fr http://bluetongue.cirad.fr/
Tel. +33 4 67 59 37 17 - Fax +33 4 67 59 37 95
Secr. +33 4 67 59 37 37 - Cell. +33 6 77 52 08 69
More information about the R-sig-Geo
mailing list