[R-sig-Geo] clip a SpatialPolygonsDataFrame
Roger Bivand
Roger.Bivand at nhh.no
Thu Aug 5 17:55:04 CEST 2010
On Thu, 5 Aug 2010, Laetitia Blanc 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 ?
The answer is no, you cannot clip such an object in the way you want. You
can subset to choose (manually) the member Polygons objects in your
subset, but you cannot change their borders by clipping. Typically,
clipping for display is done simply by using the xlim= and ylim= arguments
to plotting functions, and for most cases this is sufficient, because the
clipped objects are not needed for analysis.
It may be, before long, that you will be able to clip using an object
describing your clipping window and the input object, using rgeos, now in
development on R-Forge. The output object will, however, have to be
without attributes, because the attributes of clipped Polygons objects
cannot be assumed to be unchanged.
Hope this helps,
Roger
> thanks
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list