[R-sig-Geo] clip a SpatialPolygonsDataFrame

Robert J. Hijmans r.hijmans at gmail.com
Thu Aug 5 18:41:20 CEST 2010


Laetitia,

If it is just for display, the below could work:

library(sp)
library(maptools)
library(gpclib) # non-commerical use only
library(PBSmapping)

a = SpatialPolygons2PolySet(france)
b = SpatialPolygons2PolySet(box)

intersect = joinPolys(a, b, "INT")
## a necessary hack because for
## PolySet2SpatialPolygons projection
## LL or UTM and not missing
attr(intersect, "projection") = "UTM"
attr(intersect, "zone") = "12"
##
francebox = PolySet2SpatialPolygons(intersect)
francebox at proj4string = france at proj4string


Robert

On Thu, Aug 5, 2010 at 8:16 AM, Laetitia Blanc
<blanc.laetitia.esr34 at gmail.com> wrote:
>
> hi,
>
> i would like to know how to clip a map ("france") that i loaded with the
> function readShapePoly. Now, it's a SpatialPolygonsDataFrame.
>
> I want to clip the map "france" according to specific coordinates in order
> to obtain a new map corresponding to a specific part of the original map
> (for example the eastern part of France).
>
> Can someone help me ?
> thanks
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/clip-a-SpatialPolygonsDataFrame-tp5376909p5376909.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list