[R-sig-Geo] apply a formula by matrix

2011-07-07 Thread Alfredo Alessandrini
Hi,

I've to apply a formula to a raster in relation to an index table
created from raster stack.

I'm trying to explain the problem:

I've three raster with same resolution, that I join in a raster
RasterStack, and from it I can obtain a table like this:

>  data <- stack(dem,aer550,aer550_type)

>  unique(as.matrix(data))
  layer_1  layer_2 layer_3
 [1,]   1 0.246000   2
 [2,]   1 0.184500   2
 [3,]   1 0.01   2
 [4,]   0 0.01   2
 [5,]   1 0.147600   2
 [6,]   1 0.01   0
 [7,]   0 0.01   0
.


>From this table I develop a linear model that after I've to apply to
another raster that isn't in the raster stack and it has a higher
resolution.

I've to compute the function for the raster with higher resolution,
according to the coefficients of the rows, and only for specific
pixels.(layer_1 = 1 AND layer_2 = 0.246 AND layer_3 = 2) --> function
( -0.2710751  0.7981552 )


   layer_1  layer_2 layer_3coeff_model_1  coeff_model_2
11 0.246000   2 -0.2710751  0.7981552
21 0.184500   2 -1.1499351 -0.6216590
31 0.01   2 -0.6643215  0.1993647
40 0.01   2 -1.0418143  1.5379033
51 0.147600   2  2.3148048  0.8951158
61 0.01   0 -0.2710751  0.7981552
70 0.01   0 -1.1499351 -0.6216590
...
...


Thanks in advance,

Alfredo

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


[R-sig-Geo] how to get a SpatialGrid object from a .gri file ?

2011-07-07 Thread camille garcin
Hello

I got a .gri file (data about density of population in Ireland from
http://www.diva-gis.org/gdata) that I would like to read with the readGDAL
function from the *rgdal* package. So have I to get a SpatialGrid object
from this file. Could you tell me if it's possible to do that with the *
rgdal* package (because I didn't succeed in...) ? I was told to use the *
raster* package but I would like to do so thanks to the *rgdal* package,
downloading as few packages more as possible.

Thank you for your help.
Yours sincerely,
Camille Garcin

[[alternative HTML version deleted]]

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


[R-sig-Geo] spatial modelling Lectureship at the University of Bristol

2011-07-07 Thread Malcolm Fairbrother
Dear list,

Please see below an announcement about a job opening in the School of 
Geographical Sciences at the University of Bristol. The post is only just being 
advertised today, but there is a need to have someone in post by October -- so 
there is a very short time before the deadline.

Subscribers to this list looking for a beginning academic appointment in the 
social sciences would be very appropriate applicants. Please be aware the post 
is for three years.

- Malcolm

Dr Malcolm Fairbrother
Lecturer
School of Geographical Sciences
University of Bristol

___

Lecturer in Quantitative Geography (vacancy ref. 16443)

The School of Geographical Sciences is looking to appoint an enthusiastic and 
committed person to a Lectureship in Quantitative Geography. You will deliver 
teaching in quantitative methods at both undergraduate and postgraduate levels, 
as well as other substantive areas of human geography. You will be able to 
teach regression methods, ideally through the medium of R. The post is 
advertised at three years in the first instance, and you will need to develop 
your own research agenda, contribute to initiatives within the Spatial 
Modelling research group, and participate in the range of activities in the 
School as well as building strong research links more broadly.

You will become a member of the Spatial Modelling Research Group 
(www.bris.ac.uk/geography/research/spatial-modelling/) which has an 
international reputation as a leading centre for spatial analysis. It focuses 
on innovative methodologies and techniques for the analysis of spatial data and 
their application to social, political and economic research problems. In 
addition the Group has a strong interest in the development of innovative 
social science software.

This Lectureship offers an exciting opportunity to join this innovative 
research group and to contribute to future developments in the School of 
Geographical Sciences.  Applications are welcomed from both human geographers 
and social scientists in cognate disciplines who have research interests in 
quantitative analysis in the social sciences using geographical data. You will 
have an emerging international reputation for research (or will be able to 
demonstrate a capacity to build such a reputation) and an excellent record of 
publication for their career stage.

Grade : Level b in Pathway 1
Salary : £33,734

Please see: http://www.bris.ac.uk/boris/jobs/feeds/ads?ID=98491

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


[R-sig-Geo] plot3D raster coordinates

2011-07-07 Thread Etienne B. Racine
Hi list,

I'd like to plot3D() a raster layer using it's own coordinates instead of
the row-col system so I can easily add points.
Here's a demo

library(raster)
library(rgl)

r <- raster(matrix(1, nrow = 5, ncol = 5))
extent(r)
# class   : Extent
# xmin: 0
# xmax: 1
# ymin: 0
# ymax: 1
plot(r)
points(0.5, 0.5) # centre of the raster


plot3D(r)
decorate3d()
rgl.points(0.5, 0.5, 1.5, col = 2) # wrong
rgl.points(3.5, 3.5, 1.5, col = 1) # it's row-col coordinates

Thanks,
Etienne

[[alternative HTML version deleted]]

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


Re: [R-sig-Geo] plot3D raster coordinates

2011-07-07 Thread Etienne B. Racine
I don't know if this will clarify or add to the confusion as I don't know if
it's the same issue or another one with the same effect, but when using a
projected raster, I get some weird coordinates in 3d (really large). I can't
see how it is linked to my raster coordinates.

Example :
library(raster)
library(rgl)
new("RasterLayer"
, file = new(".RasterFile"
, name = ""
, datanotation = "FLT4S"
, byteorder = "little"
, nodatavalue = -Inf
, nbands = 1L
, bandorder = "BIL"
, offset = 0L
, toptobottom = TRUE
, driver = ""
)
, data = new(".SingleLayerData"
, values = c(2.7659912109375, 2.07601928710938, 1.8389648438,
1.7440185546875,
1.6610107421875, 2.28298950195312, 3.67398071289062, 2.23001098632812,
2.50997924804688, 2.92999267578125, 2.22100830078125, 2.83200073242188,
4.6510009765625, 3.69601440429688, 3.20401000976562, 2.7750244140625,
2.1190185546875, 3.20901489257812, 5.39801025390625, 4.65200805664062,
3.69699096679688, 3.25399780273438, 1.98800659179688, 3.38198852539062,
5.93698120117188, 3.697021484375, 1.6610351562, 1.60601806640625,
0.739013671875, 1.7080078125, 7.50399780273438, 1.34100341796875,
0.93597412109375, 1.01699829101562, 1.02999877929688, 0.813995361328125
)
, offset = 0
, gain = 1
, inmemory = TRUE
, fromdisk = FALSE
, isfactor = FALSE
, attributes = list()
, haveminmax = TRUE
, min = 0.739013671875
, max = 7.50399780273438
, band = 1L
)
, legend = new(".RasterLegend"
, type = character(0)
, values = NULL
, color = NULL
, names = NULL
, colortable = NULL
)
, history = character(0)
, title = character(0)
, extent = new("Extent"
, xmin = 337879.01907
, xmax = 337882.01907
, ymin = 5386659.0191
, ymax = 5386662.0191
)
, rotated = FALSE
, rotation = new(".Rotation"
, geotrans = numeric(0)
, transfun = function ()
NULL
)
, ncols = 6L
, nrows = 6L
, crs = new("CRS"
, projargs = " +proj=tmerc +lat_0=0 +lon_0=-67.5 +k=0. +x_0=304800
+y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs +towgs84=0,0,0"
)
, layernames = "1271"
, z = list()
, zname = ""
, zvalue = ""
, unit = ""
)
plot(r2)
points(337880, 5386659.5)

plot3D(r2)
decorate3d() # the coordinates are really large
rgl.points(337880, 5386659.5, 10, col=1) # doesn't match with the raster

Etienne

2011/7/7 Etienne B. Racine 

> Hi list,
>
> I'd like to plot3D() a raster layer using it's own coordinates instead of
> the row-col system so I can easily add points.
> Here's a demo
>
> library(raster)
> library(rgl)
>
> r <- raster(matrix(1, nrow = 5, ncol = 5))
> extent(r)
> # class   : Extent
> # xmin: 0
> # xmax: 1
> # ymin: 0
> # ymax: 1
> plot(r)
> points(0.5, 0.5) # centre of the raster
>
>
> plot3D(r)
> decorate3d()
> rgl.points(0.5, 0.5, 1.5, col = 2) # wrong
> rgl.points(3.5, 3.5, 1.5, col = 1) # it's row-col coordinates
>
> Thanks,
> Etienne
>
>

[[alternative HTML version deleted]]

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


[R-sig-Geo] Error in anyDuplicated.default(coords) message with trinb

2011-07-07 Thread Stratford, Jeffrey
Hi everyone,

 

I'm attempting to do some spatial analyses with a relatively simple data
set and I'm running into some issues.  Here's my code:

 

sosp09 <- read.csv("f:\\sosp\\2009\\sosp09.means.csv", header=T)

sp.point <- cbind(sosp09$x, sosp09$y)

colnames(sp.point) <- c("LONG","LAT") 

# Projection: UTM Zone 17

proj <- CRS("+proj=utm +zone=18 +datum=WGS84")

# Create spatial object

data.sp <- SpatialPointsDataFrame(coords=sp.point, data=sosp09,
proj4string=proj)

## Bounding box of data points

bbox(data.sp)

#build neighborhood

sosp.neigh <- tri2nb(data.sp)

 

And, with the last step, I get 

 

Error in anyDuplicated.default(coords) : 

  anyDuplicated() applies only to vectors

 

I went through and removed duplicated rows by averaging the responses
and I still get this message.  I also removed via rm() all the objected
from the original analysis and I still get this message.  Any ideas
what's going on?

 

Thanks,

 

Jeff

 

The data:

 

 

new("SpatialPointsDataFrame"

, data = structure(list(band = c(6467L, 6483L, 6466L, 6465L, 6463L,
6462L, 

6498L, 6443L, 6496L, 6495L, 6459L, NA, 6458L, 6491L, 6446L, 6464L, 

NA, 6473L, 6444L, 6457L, 6468L, NA, 6485L, 6474L, 6445L, 6486L, 

6488L, 6472L, 6493L, 6492L, 6471L, 6449L, 6453L, 6460L, 6482L

), site = structure(c(19L, 26L, 18L, 17L, 15L, 14L, 35L, 1L, 

34L, 33L, 12L, 8L, 11L, 30L, 4L, 16L, 5L, 23L, 2L, 10L, 20L, 

9L, 27L, 24L, 3L, 28L, 29L, 22L, 32L, 31L, 21L, 6L, 7L, 13L, 

25L), .Label = c("SOSP0901", "SOSP0902", "SOSP0903", "SOSP0904", 

"SOSP0905", "SOSP0906", "SOSP0908", "SOSP0909", "SOSP0910", "sosp0911", 

"sosp0912", "sosp0913", "sosp0914", "SOSP0915", "SOSP0916", "SOSP0917", 

"SOSP0918", "SOSP0919", "SOSP0920", "SOSP0921", "SOSP0925", "SOSP0926", 

"SOSP0927", "SOSP0928", "Sosp0934", "Sosp0935", "Sosp0936", "Sosp0937", 

"Sosp0938", "Sosp0940", "Sosp0941", "Sosp0942", "Sosp0943", "Sosp0944", 

"Sosp0946"), class = "factor"), sex = structure(c(1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L

), .Label = "M", class = "factor"), age = structure(c(1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L), .Label = "AHY", class = "factor"), wing = c(66, 62, 66, 

65, 65, 64.5, 66, 69, 64.5, 67.5, 66, 66.5, 68, 67, 66, 67, 64.5, 

68, 65, 65, 66, 65.5, 65, 66, 64, 65, 65, 66, 66, 63, 67, 66, 

66, 65, 64), tail = c(69, 67, 69, 66, 67, 65, 66, 68, 64, 67.5, 

66, 66, 67, 67, 67, 70, 69, 64, 67, 69, 68, 65.5, 66, 67, 65, 

66, 66, 68, 71, 55, 72, 62, 70, 70, 66), bill = c(9, 9.7, 9.6, 

9.5, 9.6, 8.5, 9.2, 9.5, 8.4, 9.2, 9.9, 8.8, 8.8, 9.2, 8.6, 9.6, 

9.15, 9.7, 9.7, 8.7, 8.9, 9.45, 8.8, 9.1, 9.2, 9.2, 9.1, 8.9, 

9.6, 8.7, 9.2, 8.8, 9.2, 9, 9.3), tarsus = c(21.6, 20.6, 20.9, 

21.8, 20.9, 19.6, 22, 21.5, 21.7, 21.3, 22.1, 21.15, 19.9, 22.4, 

22, 20.1, 21.85, 21.6, 20.9, 21.5, 22.4, 21.5, 21.3, 21.2, 21.5, 

20.6, 21.4, 21.4, 21.4, 21.7, 21.4, 21.1, 20.6, 20.1, 22.2), 

mass = c(20.8, 20.6, 21.1, 22.3, NA, 16.7, 23, 23.2, 20.7, 

20.9, 27.3, 21.1, 21.4, 24.3, 23.2, 21.7, 22, 21, NA, 20.1, 

20.5, 21.4, 20.5, 23.3, 21.5, 20.5, 20.8, 21, 21.3, 20.3, 

20.4, 21, 22.9, 19.7, 21.5), x = c(1647222L, 1648242L, 1648272L, 

1648422L, 1651242L, 1652472L, 1652472L, 1653042L, 1653282L, 

1653372L, 1654092L, 1654212L, 1654362L, 1655082L, 1657032L, 

1657212L, 1657272L, 1657932L, 1658292L, 1658412L, 1658772L, 

1659072L, 1659192L, 1659342L, 1659702L, 1659762L, 1659912L, 

1660692L, 1660872L, 1661022L, 1661082L, 1662042L, 1662192L, 

1663362L, 1663512L), y = c(2207359L, 2206909L, 2207479L, 

2202859L, 2203219L, 2204599L, 2198299L, 2194849L, 2202889L, 

2208229L, 2199469L, 2199649L, 2199769L, 2202589L, 2198089L, 

2201449L, 2198029L, 2201209L, 2202529L, 2201989L, 2203549L, 

2202529L, 2203519L, 2201209L, 2202499L, 2204179L, 2203459L, 

2200939L, 2208469L, 2208709L, 2201419L, 2204299L, 2204989L, 

2206339L, 2202619L), urban1 = c(0.1724138, 0.2068966, 0.06896552, 

0.2413793, 0.5172413, 0.34482762, 0.55172422, 0.138, 0.06896552, 

0.03448276, 0.06896552, 1, 0.9655172, 0.4827586, 0.966, 0.8965516, 

0.31, 1, 1, 0.9996, 0.79310346, 1, 1.0012, 0.9992, 

1, 0.9998, 1, 0.999, 0.48275866, 1, 1.001, 1, 

1, 1, 0.7241379), urban2 = c(0.2214765, 0.12751683, 0.18791945, 

0.09395973, 0.24832219, 0.1946309, 0.32885906, 0.315, 0.08724833, 

0.05369128, 0.3959732, 0.583892609, 0.77181212, 0.42281877, 

0.758, 0.6577181, 0.564, 1.0014, 0.993, 0.9997, 0.63758395, 

0.7919463, 1.0003, 1, 1, 1.001, 0.73154363, 1.0004, 

0.59731537, 0.8993289, 0.97315443, 1, 0.913, 1.0001, 

0.75838925), urbank = c(0.0976826, 0.210325588, 0.360516315, 

0.063361691, 0.060721623, 0.23995307, 0.18979175, 0.275, 

0.065708423, 0.1589909, 0.33294

Re: [R-sig-Geo] Error in anyDuplicated.default(coords) message with trinb

2011-07-07 Thread Edzer Pebesma
Jeff, ?tri2nb suggests you to try

tri2nb(coordinates(data.sp))

On 07/07/2011 03:52 PM, Stratford, Jeffrey wrote:
> Hi everyone,
> 
>  
> 
> I'm attempting to do some spatial analyses with a relatively simple data
> set and I'm running into some issues.  Here's my code:
> 
>  
> 
> sosp09 <- read.csv("f:\\sosp\\2009\\sosp09.means.csv", header=T)
> 
> sp.point <- cbind(sosp09$x, sosp09$y)
> 
> colnames(sp.point) <- c("LONG","LAT") 
> 
> # Projection: UTM Zone 17
> 
> proj <- CRS("+proj=utm +zone=18 +datum=WGS84")
> 
> # Create spatial object
> 
> data.sp <- SpatialPointsDataFrame(coords=sp.point, data=sosp09,
> proj4string=proj)
> 
> ## Bounding box of data points
> 
> bbox(data.sp)
> 
> #build neighborhood
> 
> sosp.neigh <- tri2nb(data.sp)
> 
>  
> 
> And, with the last step, I get 
> 
>  
> 
> Error in anyDuplicated.default(coords) : 
> 
>   anyDuplicated() applies only to vectors
> 
>  
> 
> I went through and removed duplicated rows by averaging the responses
> and I still get this message.  I also removed via rm() all the objected
> from the original analysis and I still get this message.  Any ideas
> what's going on?
> 
>  
> 
> Thanks,
> 
>  
> 
> Jeff
> 
>  
> 
> The data:
> 
>  
> 
>  
> 
> new("SpatialPointsDataFrame"
> 
> , data = structure(list(band = c(6467L, 6483L, 6466L, 6465L, 6463L,
> 6462L, 
> 
> 6498L, 6443L, 6496L, 6495L, 6459L, NA, 6458L, 6491L, 6446L, 6464L, 
> 
> NA, 6473L, 6444L, 6457L, 6468L, NA, 6485L, 6474L, 6445L, 6486L, 
> 
> 6488L, 6472L, 6493L, 6492L, 6471L, 6449L, 6453L, 6460L, 6482L
> 
> ), site = structure(c(19L, 26L, 18L, 17L, 15L, 14L, 35L, 1L, 
> 
> 34L, 33L, 12L, 8L, 11L, 30L, 4L, 16L, 5L, 23L, 2L, 10L, 20L, 
> 
> 9L, 27L, 24L, 3L, 28L, 29L, 22L, 32L, 31L, 21L, 6L, 7L, 13L, 
> 
> 25L), .Label = c("SOSP0901", "SOSP0902", "SOSP0903", "SOSP0904", 
> 
> "SOSP0905", "SOSP0906", "SOSP0908", "SOSP0909", "SOSP0910", "sosp0911", 
> 
> "sosp0912", "sosp0913", "sosp0914", "SOSP0915", "SOSP0916", "SOSP0917", 
> 
> "SOSP0918", "SOSP0919", "SOSP0920", "SOSP0921", "SOSP0925", "SOSP0926", 
> 
> "SOSP0927", "SOSP0928", "Sosp0934", "Sosp0935", "Sosp0936", "Sosp0937", 
> 
> "Sosp0938", "Sosp0940", "Sosp0941", "Sosp0942", "Sosp0943", "Sosp0944", 
> 
> "Sosp0946"), class = "factor"), sex = structure(c(1L, 1L, 1L, 
> 
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
> 
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L
> 
> ), .Label = "M", class = "factor"), age = structure(c(1L, 1L, 
> 
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
> 
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
> 
> 1L), .Label = "AHY", class = "factor"), wing = c(66, 62, 66, 
> 
> 65, 65, 64.5, 66, 69, 64.5, 67.5, 66, 66.5, 68, 67, 66, 67, 64.5, 
> 
> 68, 65, 65, 66, 65.5, 65, 66, 64, 65, 65, 66, 66, 63, 67, 66, 
> 
> 66, 65, 64), tail = c(69, 67, 69, 66, 67, 65, 66, 68, 64, 67.5, 
> 
> 66, 66, 67, 67, 67, 70, 69, 64, 67, 69, 68, 65.5, 66, 67, 65, 
> 
> 66, 66, 68, 71, 55, 72, 62, 70, 70, 66), bill = c(9, 9.7, 9.6, 
> 
> 9.5, 9.6, 8.5, 9.2, 9.5, 8.4, 9.2, 9.9, 8.8, 8.8, 9.2, 8.6, 9.6, 
> 
> 9.15, 9.7, 9.7, 8.7, 8.9, 9.45, 8.8, 9.1, 9.2, 9.2, 9.1, 8.9, 
> 
> 9.6, 8.7, 9.2, 8.8, 9.2, 9, 9.3), tarsus = c(21.6, 20.6, 20.9, 
> 
> 21.8, 20.9, 19.6, 22, 21.5, 21.7, 21.3, 22.1, 21.15, 19.9, 22.4, 
> 
> 22, 20.1, 21.85, 21.6, 20.9, 21.5, 22.4, 21.5, 21.3, 21.2, 21.5, 
> 
> 20.6, 21.4, 21.4, 21.4, 21.7, 21.4, 21.1, 20.6, 20.1, 22.2), 
> 
> mass = c(20.8, 20.6, 21.1, 22.3, NA, 16.7, 23, 23.2, 20.7, 
> 
> 20.9, 27.3, 21.1, 21.4, 24.3, 23.2, 21.7, 22, 21, NA, 20.1, 
> 
> 20.5, 21.4, 20.5, 23.3, 21.5, 20.5, 20.8, 21, 21.3, 20.3, 
> 
> 20.4, 21, 22.9, 19.7, 21.5), x = c(1647222L, 1648242L, 1648272L, 
> 
> 1648422L, 1651242L, 1652472L, 1652472L, 1653042L, 1653282L, 
> 
> 1653372L, 1654092L, 1654212L, 1654362L, 1655082L, 1657032L, 
> 
> 1657212L, 1657272L, 1657932L, 1658292L, 1658412L, 1658772L, 
> 
> 1659072L, 1659192L, 1659342L, 1659702L, 1659762L, 1659912L, 
> 
> 1660692L, 1660872L, 1661022L, 1661082L, 1662042L, 1662192L, 
> 
> 1663362L, 1663512L), y = c(2207359L, 2206909L, 2207479L, 
> 
> 2202859L, 2203219L, 2204599L, 2198299L, 2194849L, 2202889L, 
> 
> 2208229L, 2199469L, 2199649L, 2199769L, 2202589L, 2198089L, 
> 
> 2201449L, 2198029L, 2201209L, 2202529L, 2201989L, 2203549L, 
> 
> 2202529L, 2203519L, 2201209L, 2202499L, 2204179L, 2203459L, 
> 
> 2200939L, 2208469L, 2208709L, 2201419L, 2204299L, 2204989L, 
> 
> 2206339L, 2202619L), urban1 = c(0.1724138, 0.2068966, 0.06896552, 
> 
> 0.2413793, 0.5172413, 0.34482762, 0.55172422, 0.138, 0.06896552, 
> 
> 0.03448276, 0.06896552, 1, 0.9655172, 0.4827586, 0.966, 0.8965516, 
> 
> 0.31, 1, 1, 0.9996, 0.79310346, 1, 1.0012, 0.9992, 
> 
> 1, 0.9998, 1, 0.999, 0.48275866, 1, 1.001, 1, 
> 
> 1, 1, 0.7241379), urban2 = c(0.2214765, 0.12751683, 0.18791945, 
> 
> 0.09395973, 0.24832219, 0.1946309, 0.32885906

[R-sig-Geo] Mapping contours from jpg map

2011-07-07 Thread Sarah Papworth
Dear all,

I have a jpg map of altitudinal contours in my study area which I
would like to map and use in R to calculate the altitude and slope of
GPS coordinates.
So far, I have painstakingly traced these contours in ArcMap to create
a shapefile (of polylines) with altitude. I have now imported this
file shapefile into R.

 What I would like to do is turn it into a raster of slope and
altitude, but I can't seem to find any method of doing this in the
online R help archives. Does anyone have any idea which package I
should be using, or perhaps if it is even possible to turn this type
of shapefile into a raster?

Thanks in advance!

Sarah


-- 
Imperial College London
http://www.iccs.org.uk/sarahpapworth.htm

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


Re: [R-sig-Geo] Mapping contours from jpg map

2011-07-07 Thread Barry Rowlingson
On Thu, Jul 7, 2011 at 5:25 PM, Sarah Papworth
 wrote:
> Dear all,
>
> I have a jpg map of altitudinal contours in my study area which I
> would like to map and use in R to calculate the altitude and slope of
> GPS coordinates.
> So far, I have painstakingly traced these contours in ArcMap to create
> a shapefile (of polylines) with altitude. I have now imported this
> file shapefile into R.
>
>  What I would like to do is turn it into a raster of slope and
> altitude, but I can't seem to find any method of doing this in the
> online R help archives. Does anyone have any idea which package I
> should be using, or perhaps if it is even possible to turn this type
> of shapefile into a raster?

 There's definitely tools for doing this in GRASS-GIS:

http://linfiniti.com/2010/12/3d-visualisation-and-dem-creation-in-qgis-with-the-grass-plugin/

 but not sure about R. One approach might be:

 load shapefile into R as a SpatialLinesDataFrame, so that each line
has its height attribute.

 consider a grid of points over the space, and use rgeos functions to
find the nearest contour line and its height. Assign height to that
grid point.

 That will give you a grid that will look a bit like terraces between
the contours, which you could possibly then smooth, although there may
be systematic errors with this method...

 I suspect there's a better way by looking at more than one nearby
contour line and doing some interpolation

Actually the GRASS algorithms are discussed here:

http://grass.osgeo.org/wiki/Contour_lines_to_DEM

Barry

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


Re: [R-sig-Geo] Mapping contours from jpg map

2011-07-07 Thread Barry Rowlingson
>  I suspect there's a better way by looking at more than one nearby
> contour line and doing some interpolation

 I've got fairly good algorithm going now, but it requires a bit of
modification of some sp package code.

 Currently spsample can return random or regular  points on a line,
but doesn't tell you which line the point came from. Hence there's no
way to get the height of that line.

 But a bit of tweaking to the sampling code fixes that. My
modification returns a spatial points data frame of points and line
IDs. I'll not post that code here yet because Roger usually knows ways
of doing my hacky things without hacking. I know that overlay() won't
do it for you...

 Anyway, then I can get a set of (x,y,height) points on the contour
lines, and then use any standard interpolation function (interp from
akima for example) to get a grid. Looks pretty good, and also pretty
quick. A 500x500 grid from a contour set with 212 contour lines is
pretty instantaneous.

Barry

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


[R-sig-Geo] Running R on a Computer Cluster in the Cloud - cloudnumbers.com

2011-07-07 Thread Markus Schmidberger
Dear analysts for geographical data and R users,

cloudnumbers.com provides researchers and companies with the resources
to perform high performance calculations in the cloud. As
cloudnumbers.com's community manager I may invite you to register and
test R on a computer cluster in the cloud for free:
http://my.cloudnumbers.com/register

Our aim is to change the way of research collaboration is done today by
bringing together scientists and businesses from all over the world on a
single platform. cloudnumbers.com is a Berlin (Germany) based
international high-tech startup striving for enabling everyone to
benefit from the High Performance Computing related advantages of the
cloud. We provide easy access to applications running on any kind of
computer hardware: from single core high memory machines up to 1000
cores computer clusters.

Our platform provides several advantages:

* Turn fixed into variable costs and pay only for the capacity you need.
Watch our latest saving costs with cloudnumbers.com video:
http://www.youtube.com/watch?v=ln_BSVigUhg&feature=player_embedded

* Enter the cloud using an intuitive and user friendly platform. Watch
our latest cloudnumbers.com in a nutshell video:
http://www.youtube.com/watch?v=0ZNEpR_ElV0&feature=player_embedded

* Be released from ongoing technological obsolescence and continuous
maintenance costs (e.g. linking to libraries or system dependencies)

* Accelerated your R, C, C++, Fortran, Python, ... calculations through
parallel processing and great computing capacity - more than 1000 cores
are available and GPUs are coming soon.

* Share your results worldwide (coming soon).

* Get high speed access to public databases.

* We have developed a security architecture that meets high requirements
of data security and privacy. Read our security white paper:
http://d1372nki7bx5yg.cloudfront.net/wp-content/uploads/2011/06/cloudnumberscom-security.whitepaper.pdf


This is only a selection of our top features. To get more information
check out our web-page (http://www.cloudnumbers.com/) or follow our blog
about cloud computing, HPC and HPC applications (with R):
http://cloudnumbers.com/blog

Register and test for free now at cloudnumbers.com:
http://my.cloudnumbers.com/register

We are looking forward to get your feedback and consumer insights.

Best
Markus

-- 
Dr. rer. nat. Markus Schmidberger 
Senior Community Manager 

Cloudnumbers.com GmbH
Chausseestraße 6
10119 Berlin 

www.cloudnumbers.com 
E-Mail: markus.schmidber...@cloudnumbers.com 


* 
Amtsgericht München, HRB 191138 
Geschäftsführer: Erik Muttersbach, Markus Fensterer, Moritz v. 
Petersdorff-Campen 



Diese Nachricht kann vertrauliche Informationen enthalten. Sollten Sie 
nicht der vorgesehene Empfänger sein, so bitten wir um eine kurze 
Nachricht. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist 
unzulässig. Da wir nicht die Echtheit oder  Vollständigkeit der in 
dieser Nachricht enthaltenen Informationen garantieren können, 
schließen wir die rechtliche Verbindlichkeit der vorstehenden 
Erklärungen und Äußerungen aus. 
This message may contain confidential information. If yo...{{dropped:6}}

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


[R-sig-Geo] GLS model

2011-07-07 Thread Yiching Lin
Dear all,

I have been using the GLS model provided by nlme package in R.  I was
wondering if it is possible to estimate an equivalent of R square for
GLS in any R package.  Nlme package did not provide such estimations.
The only application that I found is Spatial Modeling Environment
(SME).   Thank you very much!

Best,
Yiching



Yiching Lin, Ph.D.
Assistant Professor

Department of Life Science
Tunghai University
No. 181, Sec. 3
Taichung Port Rd., Taichung 40704, Taiwan
Phone: +886-4-2590121 ext. 32406
Fax: +886-4-23590296

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