lunch at Chize demain?

A+
Luca


-----Original Message-----
From: r-sig-geo-request@r-project.org
To: r-sig-geo@r-project.org
Date: Sat, 30 Mar 2013 12:00:03 +0100
Subject: R-sig-Geo Digest, Vol 115, Issue 29


Send R-sig-Geo mailing list submissions to
   r-sig-geo@r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
   https://stat.ethz.ch/mailman/listinfo/r-sig-geo 
[https://stat.ethz.ch/mailman/listinfo/r-sig-geo]
or, via email, send a message with subject or body 'help' to
   r-sig-geo-request@r-project.org

You can reach the person managing the list at
   r-sig-geo-owner@r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-sig-Geo digest..."


Today's Topics:

   1. intersection of polygons (Ross Ahmed)
   2. Re: intersection of polygons (Roger Bivand)
   3. Re: intersection of polygons (Edzer Pebesma)
   4. BUG in set.pluginOption() in spGRASS6 (Rainer M Krug)
   5. Re: intersection of polygons (Ross Ahmed)
   6. Re: intersection of polygons (Edzer Pebesma)
   7. extract polygon (Ross Ahmed)
   8. Re: extract polygon (Edzer Pebesma)
   9. McSpatial discontinued (Andreas For? Tollefsen)
  10. Re: McSpatial discontinued (Roger Bivand)
  11. Re: drawing order in spplot and Line width in sp maps
      (Mikhail Titov)


----------------------------------------------------------------------

Message: 1
Date: Fri, 29 Mar 2013 12:26:50 +0000
From: Ross Ahmed <rossahmed@googlemail.com>
To: <r-sig-geo@r-project.org>
Subject: [R-sig-Geo] intersection of polygons
Message-ID: <CD7B390A.44CC%rossahmed@gmail.com>
Content-Type: text/plain

Hi all,

I have this list of polygons:

library(sp)
p1 <- Polygon(cbind(c(-1.672487,-1.663689,-1.663185,-1.672258,-1.672487),
                    c(55.58951,55.58948,55.58249,55.58260,55.58951)))
p2 <- Polygon(cbind(c(-1.663689, -1.655508, -1.65514, -1.6633, -1.663689),
                    c(55.589485, 55.589554, 55.582396, 55.582428,
55.589485)))
p3 <- Polygon(cbind(c(-1.672224, -1.663046, -1.662525, -1.672137,
-1.672224),
                    c(55.582142, 55.582044, 55.575139, 55.575348,
55.582142)))

sp1 <- Polygons(list(Polygon(p1)),"p1")
sp2 <- Polygons(list(Polygon(p2)),"p2")
sp3 <- Polygons(list(Polygon(p3)),"p3")
spAll <- SpatialPolygons(list(sp1, sp2, sp3))
proj4string(spAll) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")


Š.and also this single polygon:

poly1 <- Polygon(cbind(c(-1.666566, -1.659071, -1.658532, -1.666459,
-1.666566),
                       c(55.586296, 55.586357, 55.580414, 55.580505,
55.586296)))
spoly1 <- Polygons(list(Polygon(poly1)),"poly1")
spoly1 <- SpatialPolygons(list(spoly1))
proj4string(spoly1) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")


I need to find the proportion of ³spoly1² that is overlapped by ³sp1²,
³sp2², ³sp3² and no polygon. The output should be something like:

0.40, 0.30, 0.20, 0.10

Thanks
Ross



   [[alternative HTML version deleted]]



------------------------------

Message: 2
Date: Fri, 29 Mar 2013 13:54:43 +0100
From: Roger Bivand <Roger.Bivand@nhh.no>
To: Ross Ahmed <rossahmed@googlemail.com>
Cc: r-sig-geo@r-project.org
Subject: Re: [R-sig-Geo] intersection of polygons
Message-ID: <alpine.LRH.2.03.1303291353300.24489@reclus.nhh.no>
Content-Type: text/plain; format=flowed; charset="US-ASCII"

On Fri, 29 Mar 2013, Ross Ahmed wrote:

> Hi all,
>
> I have this list of polygons:
>
> library(sp)
> p1 <- Polygon(cbind(c(-1.672487,-1.663689,-1.663185,-1.672258,-1.672487),
>                    c(55.58951,55.58948,55.58249,55.58260,55.58951)))
> p2 <- Polygon(cbind(c(-1.663689, -1.655508, -1.65514, -1.6633, -1.663689),
>                    c(55.589485, 55.589554, 55.582396, 55.582428,
> 55.589485)))
> p3 <- Polygon(cbind(c(-1.672224, -1.663046, -1.662525, -1.672137,
> -1.672224),
>                    c(55.582142, 55.582044, 55.575139, 55.575348,
> 55.582142)))
>
> sp1 <- Polygons(list(Polygon(p1)),"p1")
> sp2 <- Polygons(list(Polygon(p2)),"p2")
> sp3 <- Polygons(list(Polygon(p3)),"p3")
> spAll <- SpatialPolygons(list(sp1, sp2, sp3))
> proj4string(spAll) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
>
>
> ?.and also this single polygon:
>
> poly1 <- Polygon(cbind(c(-1.666566, -1.659071, -1.658532, -1.666459,
> -1.666566),
>                       c(55.586296, 55.586357, 55.580414, 55.580505,
> 55.586296)))
> spoly1 <- Polygons(list(Polygon(poly1)),"poly1")
> spoly1 <- SpatialPolygons(list(spoly1))
> proj4string(spoly1) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
>
>
> I need to find the proportion of ?spoly1? that is overlapped by ?sp1?,
> ?sp2?, ?sp3? and no polygon. The output should be something like:
>
> 0.40, 0.30, 0.20, 0.10

library(rgeos)
gArea(spoly1)
gArea(gIntersection(spAll, spoly1, byid=TRUE), byid=TRUE)/gArea(spoly1)

but note the warnings. You'll need to project both objects to get a proper
measure.

Roger

>
> Thanks
> Ross
>
>
>
>    [[alternative HTML version deleted]]
>
>

--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand@nhh.no



------------------------------

Message: 3
Date: Fri, 29 Mar 2013 14:01:27 +0100
From: Edzer Pebesma <edzer.pebesma@uni-muenster.de>
To: r-sig-geo@r-project.org
Subject: Re: [R-sig-Geo] intersection of polygons
Message-ID: <515590A7.3060304@uni-muenster.de>
Content-Type: text/plain; charset=ISO-8859-1



On 03/29/2013 01:54 PM, Roger Bivand wrote:
> On Fri, 29 Mar 2013, Ross Ahmed wrote:
>
>> Hi all,
>>
>> I have this list of polygons:
>>
>> library(sp)
>> p1 <- Polygon(cbind(c(-1.672487,-1.663689,-1.663185,-1.672258,-1.672487),
>>                    c(55.58951,55.58948,55.58249,55.58260,55.58951)))
>> p2 <- Polygon(cbind(c(-1.663689, -1.655508, -1.65514, -1.6633,
>> -1.663689),
>>                    c(55.589485, 55.589554, 55.582396, 55.582428,
>> 55.589485)))
>> p3 <- Polygon(cbind(c(-1.672224, -1.663046, -1.662525, -1.672137,
>> -1.672224),
>>                    c(55.582142, 55.582044, 55.575139, 55.575348,
>> 55.582142)))
>>
>> sp1 <- Polygons(list(Polygon(p1)),"p1")
>> sp2 <- Polygons(list(Polygon(p2)),"p2")
>> sp3 <- Polygons(list(Polygon(p3)),"p3")
>> spAll <- SpatialPolygons(list(sp1, sp2, sp3))
>> proj4string(spAll) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
>>
>>
>> ?.and also this single polygon:
>>
>> poly1 <- Polygon(cbind(c(-1.666566, -1.659071, -1.658532, -1.666459,
>> -1.666566),
>>                       c(55.586296, 55.586357, 55.580414, 55.580505,
>> 55.586296)))
>> spoly1 <- Polygons(list(Polygon(poly1)),"poly1")
>> spoly1 <- SpatialPolygons(list(spoly1))
>> proj4string(spoly1) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
>>
>>
>> I need to find the proportion of ?spoly1? that is overlapped by ?sp1?,
>> ?sp2?, ?sp3? and no polygon. The output should be something like:
>>
>> 0.40, 0.30, 0.20, 0.10
>
> library(rgeos)
> gArea(spoly1)
> gArea(gIntersection(spAll, spoly1, byid=TRUE), byid=TRUE)/gArea(spoly1)
>
> but note the warnings. You'll need to project both objects to get a
> proper measure.

Would errors instead of warnings not be more appropriate in this case?

--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of M?nster
Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de 
[http://ifgi.uni-muenster.de/]
http://www.52north.org/geostatistics [http://www.52north.org/geostatistics]  
    e.pebesma@wwu.de



------------------------------

Message: 4
Date: Fri, 29 Mar 2013 14:18:09 +0100
From: Rainer M Krug <r.m.krug@gmail.com>
To: Roger Bivand <Roger.Bivand@nhh.no>, r-sig-geo
   <R-sig-Geo@stat.math.ethz.ch>
Subject: [R-sig-Geo] BUG in set.pluginOption() in spGRASS6
Message-ID:
   <CAGhLh6GV6_vbPqDG2A4GGi9j1SKf__ces4TgOGQYLV6vL5HbNA@mail.gmail.com>
Content-Type: text/plain

Hi

using spgrass6_0.7-15 on Ubuntu, there is an error in the function
set.pluginOption() as it always raises an error "logical argument required".

The Check

if (!is.logical(value) || !is.null(value)) stop("logical argument required")

always returns TRUE and therefore always raises the error.

Cheers,

Rainer


--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax (F):       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug

   [[alternative HTML version deleted]]



------------------------------

Message: 5
Date: Fri, 29 Mar 2013 13:20:49 +0000
From: Ross Ahmed <rossahmed@googlemail.com>
To: "<Roger.Bivand@nhh.no>" <Roger.Bivand@nhh.no>
Cc: "<r-sig-geo@r-project.org>" <r-sig-geo@r-project.org>
Subject: Re: [R-sig-Geo] intersection of polygons
Message-ID: <EE2DDEF7-E02D-4CFA-B9F8-7E8B79726D42@gmail.com>
Content-Type: text/plain;   charset=us-ascii

Many thanks Roger.

I thought proj4string(spAll) <- CRS("+proj=longlat +ellps=WGS84 
+datum=WGS84") took care of projection, but obviously not. How do I project?

Ross

On 29 Mar 2013, at 12:54, Roger Bivand <Roger.Bivand@nhh.no> wrote:

> On Fri, 29 Mar 2013, Ross Ahmed wrote:
>
>> Hi all,
>>
>> I have this list of polygons:
>>
>> library(sp)
>> p1 <- Polygon(cbind(c(-1.672487,-1.663689,-1.663185,-1.672258,-1.672487),
>>                   c(55.58951,55.58948,55.58249,55.58260,55.58951)))
>> p2 <- Polygon(cbind(c(-1.663689, -1.655508, -1.65514, -1.6633, 
-1.663689),
>>                   c(55.589485, 55.589554, 55.582396, 55.582428,
>> 55.589485)))
>> p3 <- Polygon(cbind(c(-1.672224, -1.663046, -1.662525, -1.672137,
>> -1.672224),
>>                   c(55.582142, 55.582044, 55.575139, 55.575348,
>> 55.582142)))
>>
>> sp1 <- Polygons(list(Polygon(p1)),"p1")
>> sp2 <- Polygons(list(Polygon(p2)),"p2")
>> sp3 <- Polygons(list(Polygon(p3)),"p3")
>> spAll <- SpatialPolygons(list(sp1, sp2, sp3))
>> proj4string(spAll) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
>>
>>
>> ?.and also this single polygon:
>>
>> poly1 <- Polygon(cbind(c(-1.666566, -1.659071, -1.658532, -1.666459,
>> -1.666566),
>>                      c(55.586296, 55.586357, 55.580414, 55.580505,
>> 55.586296)))
>> spoly1 <- Polygons(list(Polygon(poly1)),"poly1")
>> spoly1 <- SpatialPolygons(list(spoly1))
>> proj4string(spoly1) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
>>
>>
>> I need to find the proportion of ?spoly1? that is overlapped by ?sp1?,
>> ?sp2?, ?sp3? and no polygon. The output should be something like:
>>
>> 0.40, 0.30, 0.20, 0.10
>
> library(rgeos)
> gArea(spoly1)
> gArea(gIntersection(spAll, spoly1, byid=TRUE), byid=TRUE)/gArea(spoly1)
>
> but note the warnings. You'll need to project both objects to get a proper 
measure.
>
> Roger
>
>>
>> Thanks
>> Ross
>>
>>
>>
>>    [[alternative HTML version deleted]]
>
> --
> Roger Bivand
> Department of Economics, NHH Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; fax +47 55 95 95 43
> e-mail: Roger.Bivand@nhh.no
>



------------------------------

Message: 6
Date: Fri, 29 Mar 2013 15:19:23 +0100
From: Edzer Pebesma <edzer.pebesma@uni-muenster.de>
To: r-sig-geo@r-project.org
Subject: Re: [R-sig-Geo] intersection of polygons
Message-ID: <5155A2EB.4070709@uni-muenster.de>
Content-Type: text/plain; charset=ISO-8859-1



On 03/29/2013 02:20 PM, Ross Ahmed wrote:
> Many thanks Roger.
>
> I thought proj4string(spAll) <- CRS("+proj=longlat +ellps=WGS84 
+datum=WGS84") took care of projection, but obviously not.

No, it only sets the proj4string, which is NA if not set; +proj=longlat
indicates unprojected data, i.e. coordinates reflect longitude and latitude.

> How do I project?

with spTransform in package rgdal - you need to choose a target CRS for
this.

>
> Ross
>
> On 29 Mar 2013, at 12:54, Roger Bivand <Roger.Bivand@nhh.no> wrote:
>
>> On Fri, 29 Mar 2013, Ross Ahmed wrote:
>>
>>> Hi all,
>>>
>>> I have this list of polygons:
>>>
>>> library(sp)
>>> p1 <- 
Polygon(cbind(c(-1.672487,-1.663689,-1.663185,-1.672258,-1.672487),
>>>                   c(55.58951,55.58948,55.58249,55.58260,55.58951)))
>>> p2 <- Polygon(cbind(c(-1.663689, -1.655508, -1.65514, -1.6633, 
-1.663689),
>>>                   c(55.589485, 55.589554, 55.582396, 55.582428,
>>> 55.589485)))
>>> p3 <- Polygon(cbind(c(-1.672224, -1.663046, -1.662525, -1.672137,
>>> -1.672224),
>>>                   c(55.582142, 55.582044, 55.575139, 55.575348,
>>> 55.582142)))
>>>
>>> sp1 <- Polygons(list(Polygon(p1)),"p1")
>>> sp2 <- Polygons(list(Polygon(p2)),"p2")
>>> sp3 <- Polygons(list(Polygon(p3)),"p3")
>>> spAll <- SpatialPolygons(list(sp1, sp2, sp3))
>>> proj4string(spAll) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
>>>
>>>
>>> ?.and also this single polygon:
>>>
>>> poly1 <- Polygon(cbind(c(-1.666566, -1.659071, -1.658532, -1.666459,
>>> -1.666566),
>>>                      c(55.586296, 55.586357, 55.580414, 55.580505,
>>> 55.586296)))
>>> spoly1 <- Polygons(list(Polygon(poly1)),"poly1")
>>> spoly1 <- SpatialPolygons(list(spoly1))
>>> proj4string(spoly1) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")
>>>
>>>
>>> I need to find the proportion of ?spoly1? that is overlapped by ?sp1?,
>>> ?sp2?, ?sp3? and no polygon. The output should be something like:
>>>
>>> 0.40, 0.30, 0.20, 0.10
>>
>> library(rgeos)
>> gArea(spoly1)
>> gArea(gIntersection(spAll, spoly1, byid=TRUE), byid=TRUE)/gArea(spoly1)
>>
>> but note the warnings. You'll need to project both objects to get a 
proper measure.
>>
>> Roger
>>
>>>
>>> Thanks
>>> Ross
>>>
>>>
>>>
>>>    [[alternative HTML version deleted]]
>>
>> --
>> Roger Bivand
>> Department of Economics, NHH Norwegian School of Economics,
>> Helleveien 30, N-5045 Bergen, Norway.
>> voice: +47 55 95 93 55; fax +47 55 95 95 43
>> e-mail: Roger.Bivand@nhh.no
>>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo 
[https://stat.ethz.ch/mailman/listinfo/r-sig-geo]
>

--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of M?nster
Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de 
[http://ifgi.uni-muenster.de/]
http://www.52north.org/geostatistics [http://www.52north.org/geostatistics]  
    e.pebesma@wwu.de



------------------------------

Message: 7
Date: Fri, 29 Mar 2013 15:32:47 +0000
From: Ross Ahmed <rossahmed@googlemail.com>
To: <r-sig-geo@r-project.org>
Subject: [R-sig-Geo] extract polygon
Message-ID: <CD7B649F.44DD%rossahmed@gmail.com>
Content-Type: text/plain

Lets say I have a several polygons stored in a SpatialPolygonsDataFrame
object. Using Œcolumbus¹ in maptools as an example:

setwd(system.file("shapes", package="maptools"))
columbus <- readShapeSpatial("columbus.shp²)

I want to extract a polygon 30 from Œcolumbus¹, and assign it to a new
SpatialPolygonsDataFrame object. I¹ve triedŠ

newSPDF <- Polygons(list(columbus@polygons[[30]]), "29²)

Šbut this didn¹t work. How can I do this?

Thanks
Ross



   [[alternative HTML version deleted]]



------------------------------

Message: 8
Date: Fri, 29 Mar 2013 17:07:27 +0100
From: Edzer Pebesma <edzer.pebesma@uni-muenster.de>
To: r-sig-geo@r-project.org
Subject: Re: [R-sig-Geo] extract polygon
Message-ID: <5155BC3F.9080008@uni-muenster.de>
Content-Type: text/plain; charset=windows-1252

Ross, what you want is subsetting, not extraction.

have you tried:

newSPDF <- columbus[30,]

Reading introductory material such as
http://cran.r-project.org/web/packages/sp/vignettes/intro_sp.pdf 
[http://cran.r-project.org/web/packages/sp/vignettes/intro_sp.pdf]
is also a good way to learn the first steps.

Bests,


On 03/29/2013 04:32 PM, Ross Ahmed wrote:
> Lets say I have a several polygons stored in a SpatialPolygonsDataFrame
> object. Using ?columbus? in maptools as an example:
>
> setwd(system.file("shapes", package="maptools"))
> columbus <- readShapeSpatial("columbus.shp?)
>
> I want to extract a polygon 30 from ?columbus?, and assign it to a new
> SpatialPolygonsDataFrame object. I?ve tried?
>
> newSPDF <- Polygons(list(columbus@polygons[[30]]), "29?)
>
> ?but this didn?t work. How can I do this?
>
> Thanks
> Ross
>
>
>
>    [[alternative HTML version deleted]]
>
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo 
[https://stat.ethz.ch/mailman/listinfo/r-sig-geo]
>

--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of M?nster
Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de 
[http://ifgi.uni-muenster.de/]
http://www.52north.org/geostatistics [http://www.52north.org/geostatistics]  
    e.pebesma@wwu.de



------------------------------

Message: 9
Date: Fri, 29 Mar 2013 20:14:02 +0100
From: Andreas For? Tollefsen <andreasft@gmail.com>
To: r-sig-geo@r-project.org
Subject: [R-sig-Geo] McSpatial discontinued
Message-ID:
   <CAGMz7DnGAKX=u3ohqWvit4w3=LDCCQhbAPyei0f7Bu-PqLb8DA@mail.gmail.com>
Content-Type: text/plain

Dear r-sig-geo people,

I have previously used the McSpatial package. However, according to it's
website it is removed from the CRAN library.
Hence, it is not available for R 2.15.3.

Does anyone know if the project is closed down?

Andreas

   [[alternative HTML version deleted]]



------------------------------

Message: 10
Date: Fri, 29 Mar 2013 21:10:18 +0100
From: Roger Bivand <Roger.Bivand@nhh.no>
To: Andreas For? Tollefsen <andreasft@gmail.com>
Cc: r-sig-geo@r-project.org, "McMillen, Daniel P"
   <mcmillen@illinois.edu>
Subject: Re: [R-sig-Geo] McSpatial discontinued
Message-ID: <alpine.LRH.2.03.1303292059050.25465@reclus.nhh.no>
Content-Type: text/plain; charset="iso-8859-15"; Format="flowed"

On Fri, 29 Mar 2013, Andreas For? Tollefsen wrote:

> Dear r-sig-geo people,
>
> I have previously used the McSpatial package. However, according to it's
> website it is removed from the CRAN library. Hence, it is not available
> for R 2.15.3.
>
> Does anyone know if the project is closed down?

I do not know specifically, but CRAN policies with regard to dependency on
non-free software (McSpatial depends on akima, which has a non-free
license) have been been made clearer. Packages depending on akima and
others with similar status must modify their own licenses, or split out
the functions involved, obliging the user to opt into the non-free license
of the upstream dependency.

You may download the source package from the CRAN package archives:

http://cran.r-project.org/src/contrib/Archive/McSpatial/ 
[http://cran.r-project.org/src/contrib/Archive/McSpatial/]

and install it from source yourself.

In this case, its author, Daniel McMillen and I are hoping that a
replacement for akima will be an adopted Google Summer of Coding project
if R gets enough project slots - see:

https://groups.google.com/forum/?fromgroups#!topic/gsoc-r/8ZUQCVlyodk 
[https://groups.google.com/forum/?fromgroups#!topic/gsoc-r/8ZUQCVlyodk]

If/when that happens, we will have a viable alternative under a free
license.

CRAN has to be concerned about license management, because (if one was a
lawyer, I am not!) funded research might be seen as a commercial activity,
as might courses for which participants pay. So many universities and
research labs are asking for better control of the licenses of R
contributed packages, and CRAN is trying to help to sort things out.

Hope this clarifies,

Roger

>
> Andreas
>
>    [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo 
[https://stat.ethz.ch/mailman/listinfo/r-sig-geo]
>

--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand@nhh.no

------------------------------

Message: 11
Date: Sat, 30 Mar 2013 00:12:12 -0500
From: Mikhail Titov <mlt@gmx.us>
To: "Edzer J. Pebesma" <e.pebesma@geo.uu.nl>
Cc: r-sig-geo@stat.math.ethz.ch
Subject: Re: [R-sig-Geo] drawing order in spplot and Line width in sp
   maps
Message-ID: <9q07gkpmpxv.fsf@gmx.us>
Content-Type: text/plain

Hi, All!

I know I'm excavating an old thread[1] (and top posting) but that is
exactly what bugs me.

I am surprised to see that I can't pass lwd directly to spplot's main
plot and not extra layouts. I can pass lwd to sp.polygons but not to
spplot directly :( Here is an incomplete snippet showing what I've tried

,----[ How do I change line width of shp polygons supplied to spplot? ]
| spplot(shp, names(d), col="grey80", lwd=5, cuts=5,
| #        par.settings = simpleTheme(lwd=3),
|       par.settings = list(superpose.polygon = list(lwd=5)),
|        panel = function(...) {
| #          panel.polygonsplot(..., lwd=3)
|          panel.polygonsplot(...)
|          sp.panel.layout(list(l.wshd, l.streams, l.struc))
|          if (panel.number()==1) {
|            sp.panel.layout(list(l.north, l.scale.bar, l.scale.text))
|          }
|        },
|        colorkey = list(
|          labels=list(
|            at = labelat,
|            labels = labeltext
|            )
|          ),
|        names.attr=droplevels(unique(rest$case)),
|        col.regions=rev(greens(14, .6))[-1])#rev(heat.colors(100)))
`----

I see that lwd for my layouts apply well, e.g., for l.wshd & l.streams
in the example above. However I can't seem to figure out how to make shp
lines thinner. I do have several variables to plot on a few panels.

Did I miss something?

P.S. Not quite related question but how does levelplot (?) estimates
color scale labels? If I leave colorkey alone, I get misplaced labels
provided cuts=5. For now, I do something like

,----[ Dirty fix for ticks & label alignment ]
| dd.rng <- range(unlist(dd), finite=TRUE)
| delta <- diff(dd.rng)
| labelat <- seq(dd.rng[1] - delta*.07, dd.rng[2] + delta*.07, length.out=7)
| labeltext <- format(exp(labelat), digits=2)
`----

I feel like there is almost a standard function for that but I can't
recall its name. Would you mind reminding if there is any?

On Mon, Jul 10, 2006 at  2:47 AM, "Edzer J. Pebesma" <e.pebesma@geo.uu.nl> 
wrote:
> Duncan Golicher wrote:
>> Great. Thanks so much. It was obvious really.
>> You also seem to have come up with one solution to the line width
>> question asked a couple of days ago,  as this works.
>>
>> spplot(chisgrid, "dem", panel = function(x,y, ...){
>>     panel.gridplot(x,y,...)
>>     sp.polygons(municipios, col=1,fill=0,lwd=3,lty=2)
>>     })
>>
>>
>>  
> Yes, or:
>
> spplot(chisgrid, "dem", sp.layout=list("sp.polygons", municipios, col=1,
> fill=0, lwd=3, lty=2, first=F))


Footnotes:
[1]  https://stat.ethz.ch/pipermail/r-sig-geo/2006-July/001174.html 
[https://stat.ethz.ch/pipermail/r-sig-geo/2006-July/001174.html]

--
Mikhail



------------------------------

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo 
[https://stat.ethz.ch/mailman/listinfo/r-sig-geo]


End of R-sig-Geo Digest, Vol 115, Issue 29
******************************************
	[[alternative HTML version deleted]]

