[R-sig-Geo] clip a SpatialPolygonsDataFrame

Roger Bivand Roger.Bivand at nhh.no
Thu Aug 5 20:56:11 CEST 2010


On Thu, 5 Aug 2010, Robert J. Hijmans wrote:

> Laetitia,
>
> If it is just for display, the below could work:
>
> library(sp)
> library(maptools)
> library(gpclib) # non-commerical use only

Not only non-commercial, but in fact excluding contract research. Please 
read the actual license terms:

http://en.wikipedia.org/wiki/General_Polygon_Clipper

copies the University of Manchester description of non-commercial:

"Non-commercial use: GPC may be used free of charge, without a licence, in 
any application which is strictly non-commercial (examples: hobbyist, 
academic research or teaching)."

On the website:

http://www.cs.man.ac.uk/~toby/alan/software/#Licensing

it is more restricted still:

"Non-commercial use of GPC (for example: private / hobbyist / education) 
GPC is free for non-commercial use only. We invite non-commercial users to 
make a voluntary donation towards the upkeep of GPC."

<rant>
The gpclib package should be avoided, and will be replaced by rgeos 
shortly. The PBSmapping authors claim to have received permission to 
bundle GPC under GPL, but the license constraints are not made manifest in 
the license of PBSmapping - this mess also needs attention.

That the University of Manchester has arguably hijacked the intellectual 
property of an employee is appears scandalous, and is in itself good 
enough reason to avoid GPC, despite its being a nice piece of work. As I 
mentioned, the R interface to GEOS should be available shortly, and 
hopefully PBSmapping will switch to that code.
</rant>

Roger

> 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
>>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
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