Re: [R-sig-Geo] Long/Lat coordinates inside a complex spherical polygon

2010-06-22 Thread Robert J. Hijmans
David, You can use overlay in sp, but that does not consider the inter-vertex curvature of the polygons. If this is a concern (i.e. your have polygons with vertices that are far apart), you could first uses geosphere::makePoly to at least avoid the worst mistakes (as in the example below). For rel

[R-sig-Geo] Long/Lat coordinates inside a complex spherical polygon

2010-06-22 Thread David Jarvis
Hi, What R package provides a way to determine if a longitude/latitude coordinate is situated inside a closed, complex spherical polygon (i.e., a point inside a polygon on Earth's surface)? For example: p <- rbind( c(-123.4447,48.5146), c(-123.3171,48.5128), c(-123.2607,48.4108), c(-123.4018,48.

[R-sig-Geo] edge/boundary delineation in R?

2010-06-22 Thread Seth J Myers
From: Seth J Myers Sent: Saturday, June 19, 2010 3:01 PM To: r-sig-geo@stat.math.ethz.ch Subject: edge/boundary delineation in R? Hi, Sorry if you see this twice. I submitted this a few days ago but have not seen it on the listserv. I need to delineat

Re: [R-sig-Geo] how to transform Polygons to SpatialPolygons

2010-06-22 Thread Hans-Jörg Bibiko
On Jun 22, 2010, at 10:29 PM, Weidong Gu wrote: > > The question is how to transform 'mainland' back into SpatialPolygons format. Hi, maybe try the following: library(maps) library(maptools) usa=map('usa',plot=F,fill=T) IDs=sapply(strsplit(usa$names,':'), function(x) x[1]) crs=CRS('+proj=lo

[R-sig-Geo] how to transform Polygons to SpatialPolygons

2010-06-22 Thread Weidong Gu
Hi, I ran into a problem in subsetting the Mainland from a usa map Library(maps) usa=map('usa',plot=F,fill=T) IDs=sapply(strsplit(state$names,':'), function(x) x[1]) crs=CRS('+proj=longlat +ellps=WGS84') sp.usa=map2SpatialPolygons(usa,IDs=usa$names,proj4string=crs) since sp.usa consists of a gro

[R-sig-Geo] RES: Plot (image( )) Real RGB Colors of an Imported GeoTIFF (readGDAL( ))

2010-06-22 Thread Rodrigo Aluizio
Excelent! Sorry for asking such a simple question. But, I was blind for such obvious thing. Rodrigo. -Mensagem original- De: r-sig-geo-boun...@stat.math.ethz.ch [mailto:r-sig-geo-boun...@stat.math.ethz.ch] Em nome de Edzer Pebesma Enviada em: terça-feira, 22 de junho de 2010 13:28 Para: r

Re: [R-sig-Geo] distances values from a point exhibit a hexagon-like distribution

2010-06-22 Thread Robert J. Hijmans
Mike, You are using a more recent version of raster. The "projs" argument in raster() was, for consistency, replaced by "crs", and gridDistance() now requires two more arguments, originValue and omitValue. In Roman's example, this: rst.grid <- gridDistance(rst.cover) should be replaced by: rst.

Re: [R-sig-Geo] Plot (image( )) Real RGB Colors of an Imported GeoTIFF (readGDAL( ))

2010-06-22 Thread Edzer Pebesma
Asssuming r g and b are on a 0 - 255 scale and form the first, second and third band in obj, which was read through readGDAL, you could use image(obj, red = 1, green = 2, blue = 3) which is image { sp } and not image { graphics }. See also library(sp) ?image.SpatialGridDataFrame On 06/22/2010 0

Re: [R-sig-Geo] Plot (image( )) Real RGB Colors of an Imported GeoTIFF (readGDAL( ))

2010-06-22 Thread Robert J. Hijmans
Rodrigo, you can try plotRGB in raster. Robert On Tue, Jun 22, 2010 at 6:57 AM, Rodrigo Aluizio wrote: > Hi List members. > > I’m actually able to import a Georeferenced image (.tiff) using readGDAL > {rgdal} and plot it using image {Graphics}. > > But the colors options available in the image fu

Re: [R-sig-Geo] Best way to get values of a raster that are not masked?

2010-06-22 Thread Mark Connolly
Not sure exactly what you are starting with but something like # ?read.csv and look for information on as.is and na.strings # depending on how clean the data are, you may want to bring them in # as is and use as.numeric etc on the specific attributes mixed = read.csv("filename.csv") good = subse

[R-sig-Geo] distance from point to line and line to line

2010-06-22 Thread Stephen G. Eick
The function spDistsN1 is pretty handy for finding the distance between a point and a set of other points taking into account projections. Are there any similar functions from finding the distance from a point to SpatialLines? What about functions to calculate the closest distance between Spat

[R-sig-Geo] Plot (image( )) Real RGB Colors of an Imported GeoTIFF (readGDAL( ))

2010-06-22 Thread Rodrigo Aluizio
Hi List members. I’m actually able to import a Georeferenced image (.tiff) using readGDAL {rgdal} and plot it using image {Graphics}. But the colors options available in the image function (topo.colors, heat.colors, terrain.colors, etc) aren’t able to adequately reproduce the original image. The

Re: [R-sig-Geo] variogram parameters

2010-06-22 Thread GEMA FERNANDEZ-AVILES CALDERON
Thank you very much Ashton and Jaime. I am thinking about them. But I would like to construct a ranking for the importance of these parameters. Thank you again, Gema De: Ashton Shortridge [mailto:ash...@msu.edu] Enviado el: mar 22/06/2010 0:11 Para: r-sig

Re: [R-sig-Geo] distances values from a point exhibit a hexagon-like distribution

2010-06-22 Thread Roman Luštrik
Thank you Jacob for pointing out the obvious I missed. Looks like distance() will do what I want. r <- raster(ncol=36,nrow=36, projs = "+proj=NA") r[] <- NA r[500] <- 1 dist <- distance(r) plot(dist) Michael, compare this output to (notice +proj=NA - see Roberts comments here

Re: [R-sig-Geo] GWR Analysis

2010-06-22 Thread Roger Bivand
On Tue, 22 Jun 2010, Pinar Aslantas Bostan wrote: Dear Roger, Thank you for your mail. I tried lm() and it doesn't resulted with negative values. Also gwr() doesn't give negative values if I don't use fit.points. OK. What this means then is that for fit.points some local coefficients with y

Re: [R-sig-Geo] distances values from a point exhibit a hexagon-like distribution

2010-06-22 Thread Jacob van Etten
Hi Roman, Nice picture. The help file says: "Distances are calculated by summing local distances between cells, which are connected with their neighbours in 8 directions." Hence, you get a hexagonal shape if the grid doesn´t have any "islands" the shortest routes have to avoid. Perhaps dist

Re: [R-sig-Geo] GWR Analysis

2010-06-22 Thread Pinar Aslantas Bostan
Dear Roger, Thank you for your mail. I tried lm() and it doesn't resulted with negative values. Also gwr() doesn't give negative values if I don't use fit.points. bw1=gwr.sel(PREC~Z+V1+V2,station,adapt=T) xx1<-gwr(PREC~Z+V1+V2,station,adapt=bw1,se.fit=T,hatmatrix=TRUE) gwrx<-xx1$SDF min(gw

Re: [R-sig-Geo] distances values from a point exhibit a hexagon-like distribution

2010-06-22 Thread Roman Luštrik
Interesting. Works for me "out of the box". > sessionInfo() R version 2.11.0 (2010-04-22) i386-pc-mingw32 locale: [1] LC_COLLATE=Slovenian_Slovenia.1250 LC_CTYPE=Slovenian_Slovenia.1250 [3] LC_MONETARY=Slovenian_Slovenia.1250 LC_NUMERIC=C [5] LC_TIME=Slovenian_Slovenia.1250 attached base packag

Re: [R-sig-Geo] distances values from a point exhibit a hexagon-like distribution

2010-06-22 Thread Michael Sumner
Sorry, but it still doesn't work for me. I'm surprised you could get passed the first line, since "projs" is not an argument to raster - it's not necessary for your example to have that set though, so I ignore it. I had to install igraph package as well, but still this fails at the gridDistance li

Re: [R-sig-Geo] distances values from a point exhibit a hexagon-like distribution

2010-06-22 Thread Roman Luštrik
Thank you Michael for taking interest in my problem. Here is the code that should work. The only difference is that here, for a polygon, I use a square instead of a circle (no biggie). I suspect gridDistance may have something to do with the "hexagon". library(raster) library(sp) rst <- raster(nro

Re: [R-sig-Geo] distances values from a point exhibit a hexagon-like distribution

2010-06-22 Thread Michael Sumner
Could you please provide a reproducible example with useable code? Cheers, Mike. On Tue, Jun 22, 2010 at 5:36 PM, Roman Luštrik wrote: > Can someone explain to me why values of distances from a point are not in a > uniform, circle-like fashion, but rather form a hexagon shape (see > image

[R-sig-Geo] distances values from a point exhibit a hexagon-like distribution

2010-06-22 Thread Roman Luštrik
Can someone explain to me why values of distances from a point are not in a uniform, circle-like fashion, but rather form a hexagon shape (see image)? Here is the code I'm using to produce this plot (kudos to Robert