Re: [R-sig-Geo] Concave hull of lat lon points?

2012-06-01 Thread Michael Sumner
Try the alphahull package, it's not integrated with the sp family but it's simple enough. On Sat, Jun 2, 2012 at 8:28 AM, Christian Jansson wrote: > Hi, > > I have a large set of points (lat lon) for which I must find the hull. The > functions rgeos::gConvexHull followed by rgeos::gBuffer work

[R-sig-Geo] Concave hull of lat lon points?

2012-06-01 Thread Christian Jansson
Hi, I have a large set of points (lat lon) for which I must find the hull. The functions rgeos::gConvexHull followed by rgeos::gBuffer work well when the points are grouped together in a circular fashion, but not when the points are for example in a banana shape (when it is better if the hull turn

Re: [R-sig-Geo] extract by attributes from raster-image to polygons

2012-06-01 Thread Robert J. Hijmans
Benny, If your goal is to compute the area of non-connected areas (patches), I think you can do: library(raster) im <- brick("P1020393.JPG") plotRGB(im) extract=(im[[1]]>50)&(im[[2]]>180)&(im[[3]]>220) # see raster::: predict for an alternative approach # create patches clmp <- clump(extract) p

Re: [R-sig-Geo] How to properly use rsaga.close.gaps()

2012-06-01 Thread Piero Campalani
Thanks Giuseppe, I actually can see that the "Close Gaps with Spline" is mentioned in the documentation, but no further info is proposed. Asking the SAGA CMD I can only get the usage (which I already knew from `rsaga.get.usage(lib="grid_tools", module=7)`: $ saga_cmd libgrid_tools.so "Close Gaps"

Re: [R-sig-Geo] Crop a raster using a shapefile

2012-06-01 Thread rafael . wueest
Check out ?mask Rafi -- Rafael Wüest Swiss Federal Research Institute WSL Zuercherstrasse 111 8903 Birmensdorf Am 01.06.2012 um 20:51 schrieb "Thiago Veloso" : > Dear all, > > When cropping a raster using a shapefile, through 'crop' function from "raster" package, only the extent is taken

[R-sig-Geo] Crop a raster using a shapefile

2012-06-01 Thread Thiago Veloso
  Dear all,   When cropping a raster using a shapefile, through 'crop' function from "raster" package, only the extent is taken into account: > r<-raster("lai2011361.Lai_1km.tif") > extent(r) class       : Extent  xmin        : -104.4326  xmax        : -29.99736  ymin        : -40.00064  ymax  

Re: [R-sig-Geo] how to combine one background color wih color gradient in KML function of Raster package

2012-06-01 Thread Robert J. Hijmans
Hi Evert, As the help file says, the image is produced by the 'image' function, so have a look at the help of that function. I think you can use the breaks argument, perhaps using many more breaks than I do in the example below: library(raster) r <- raster(nc=10, nr=10) r[] = runif(100) * 3 r[20

Re: [R-sig-Geo] "rasterize" changes the data values… why?

2012-06-01 Thread Robert J. Hijmans
Malcolm, Thanks for reporting that. You are probably using a factor with non-numeric characters. You need to transform these first to a number, or a number-like factor/character. In the next version that will be fixed too. Robert On Fri, Jun 1, 2012 at 1:28 AM, Malcolm Fairbrother < m.fairbrot...

[R-sig-Geo] alpha hull

2012-06-01 Thread Lindesay Scott-Hayward
Hi, I am just starting to use the alphahull package on a mac (OS:10.6.8 ) with R(2.14.1) but I have come across a small problem which I cannot seem to replicate using the toy examples from the package. I have approx 130,000 data locations in European waters and I want to use alpha hull to provide

[R-sig-Geo] how to combine one background color wih color gradient in KML function of Raster package

2012-06-01 Thread Thomas, Evert (Bioversity-Colombia)
Dear all, I have a raster file in which cells have either values of -999, or values ranging from 0-3 (apart from NA values obviously). I want to make a KML file from this raster in which I would like cells with values -999 to be displayed in gray and cells with values from 1-3 be colored accor

Re: [R-sig-Geo] extract by attributes from raster-image to polygons

2012-06-01 Thread BennyB
That works perfectly. Thanks so much Rafael, you are a true hero! -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/extract-by-attributes-from-raster-image-to-polygons-tp7576826p7580086.html Sent from the R-sig-geo mailing list archive at Nabble.com.

Re: [R-sig-Geo] rgdal Windows change Path to GDAL shared files / not all the Drivers

2012-06-01 Thread Roger Bivand
On Fri, 1 Jun 2012, gilles2604 wrote: Tank you, I know understand the problem even if I don't understand why the static gdal 1.9 doesn't support Postgisraster and Postgres driver (GDAL 1.9.0 normally does). What GDAL supports is dependent on its external links to other software. GDAL can be b

Re: [R-sig-Geo] rgdal Windows change Path to GDAL shared files / not all the Drivers

2012-06-01 Thread gilles2604
Tank you, I know understand the problem even if I don't understand why the static gdal 1.9 doesn't support Postgisraster and Postgres driver (GDAL 1.9.0 normally does). I tried to install the package from source, but it doesn't work...: /> install.packages(type="source",c("C:/rgdal_0.7-11.tar.gz"

Re: [R-sig-Geo] rgdal Windows change Path to GDAL shared files / not all the Drivers

2012-06-01 Thread Roger Bivand
On Fri, 1 Jun 2012, gilles2604 wrote: Hello I already used rgdal successfully on Mac and on Linux/Ubuntu... Now I try to make it work on Windows 7 (64 bit). I have installed GDAL 1.9.1 on my system, but when I do : library(rgdal), I get this: /Geospatial Data Abstraction Library extensions t

Re: [R-sig-Geo] simulating a particular autocorrelation structure for a raster

2012-06-01 Thread Hodgess, Erin
Hello! Thanks for your response. What I was trying to do (and probably explaining it wrong) was to simulate a matrix/raster such that if I looked at a measure of spatial autocorrelation, it would be around 0.9. So I attacked it via my time series train of thought and considered time periods w

Re: [R-sig-Geo] simulating a particular autocorrelation structure for a raster

2012-06-01 Thread Edzer Pebesma
Erin, I believe the following would do this: xy = expand.grid(x = 1:16, y = 1:16) d = as.matrix(dist(xy)) sim = chol(0.9 ^ d) %*% rnorm(256) require(sp) grd = SpatialPointsDataFrame(SpatialPoints(xy), data.frame(sim=sim)) gridded(grd) = TRUE spplot(grd, col.regions=bpy.colors()) I used distance

Re: [R-sig-Geo] "rasterize" changes the data values… why?

2012-06-01 Thread Malcolm Fairbrother
Robert, Thanks very much--that indeed solved the problem. However, even with the workaround, it seemed to need the values of dsmw to be numeric, not a factor--otherwise I got all all NAs. I wasn't sure if that's expected behaviour. Cheers, Malcolm On 31 May 2012, at 17:21, Robert J. Hijmans w

[R-sig-Geo] rgdal Windows change Path to GDAL shared files / not all the Drivers

2012-06-01 Thread gilles2604
Hello I already used rgdal successfully on Mac and on Linux/Ubuntu... Now I try to make it work on Windows 7 (64 bit). I have installed GDAL 1.9.1 on my system, but when I do : library(rgdal), I get this: /Geospatial Data Abstraction Library extensions to R successfully loaded Loaded GDAL runti

[R-sig-Geo] simulating a particular autocorrelation structure for a raster

2012-06-01 Thread Hodgess, Erin
Dear R Sig Geo People: I would like to create a 16x16 raster, say, with autocorrelation structure of 0.9 for nearest cell, 0.9^2 for 2nd closest, and so on. How would I go about generating that, please? I thought about putting together a correlation matrix, multiplying, and throwing in rnorm.

Re: [R-sig-Geo] extract by attributes from raster-image to polygons

2012-06-01 Thread Rafael Wüest
Hi Benny I once had the same problem and couldn't find a solution, so I coded a workaround. Adjusted to your example, this will look like: library(rgeos) library(raster) library(maptools) im=brick("P1020393.JPG") extract=(im[[1]]>50)&(im[[2]]>180)&(im[[3]]>220) poly_dissolve=rasterToPolygons(ext