Re: [R-sig-Geo] Archives Search Suggestion

2010-11-25 Thread Roman Luštrik
How about this? http://r-sig-geo.2731867.n2.nabble.com/ Cheers, Roman On Thu, Nov 25, 2010 at 3:52 PM, Brian Oney zenli...@gmail.com wrote: Hello List, Sorry if this is just spam. Maybe I couldn't find it or maybe it doesn't exist. I think it may reduce traffic and occurrence of already

Re: [R-sig-Geo] help me find a buffer around a polygon

2010-11-19 Thread Roman Luštrik
Thank you Robert, helpful as always. distance function did the trick. Maybe I should shortly describe my approach to preserve it for posterity. I have a polygon on a raster (with non-polygon cells set to NA). Using function raster::distance, I was able to calculate distance for all NA cells. I

[R-sig-Geo] help me find a buffer around a polygon

2010-11-18 Thread Roman Luštrik
Dear list, I've been searching around and I continue to do so, but in the mean time I'm seeking your advice on how to improve my approach. I'm using raster package and I'm trying to find cells around (let's call it a buffer) and inside a polygon. These subsetted cells are used for calculations

Re: [R-sig-Geo] stack() and lapply

2010-11-10 Thread Roman Luštrik
I have solved the issue by checking that the number of layers is bigger than one. It looks to me like stack() has some problems when being fed only one layer. x = character vector list.of.files - lapply(X = list.of.files, FUN = function(x) { if (length(x) 1) {

[R-sig-Geo] stack() and lapply

2010-11-09 Thread Roman Luštrik
Dear Listers, I have a list (list.of.files) of file names (character vector) with n number of elements. List of 9 $ 1: chr [1:5] binned_walker1_1.grd ... $ 2: chr [1:2] binned_walker2_1.grd ... $ 3: chr [1:3] binned_walker3_1.grd ... $ 4: chr [1:6] binned_walker4_1.grd ... $ 5: chr

Re: [R-sig-Geo] Help with polygonsToRaster

2010-10-31 Thread Roman Luštrik
Try argument mask. This should make all non-polygon area NA (assuming that's what you want). On Sun, Oct 31, 2010 at 2:08 AM, Manuel Spínola mspinol...@gmail.comwrote: Dear list members, I am trying to use polygonsToRaster function but I am not sure how to use it. I want to convert a

Re: [R-sig-Geo] How to clip and interpolate data using shapefile as a boundary

2010-10-19 Thread Roman Luštrik
You can easily clip rasters with polygons (or other rasters) via raster package. See this recent threadhttp://r-sig-geo.2731867.n2.nabble.com/Clip-a-raster-td5635474.htmlfor one example using crop() and polygonsToRaster() functions. Other than that, the packages has comprehensive vignettes and

Re: [R-sig-Geo] Extract xy values from a SpatialPolygon

2010-10-19 Thread Roman Luštrik
Assuming a SpatialPolygons object is named sampling.area, this is how I extract the coordinates. sampling.a...@polygons[[1]]@polygons[[...@coords Use str(sampling.area) to see the structure of the object. Cheers, Roman On Tue, Oct 19, 2010 at 4:50 PM, isabelle boulangeat

Re: [R-sig-Geo] reading .grd file in R?

2010-10-09 Thread Roman Luštrik
Have you tried raster package? On Sat, Oct 9, 2010 at 1:32 AM, govin...@msu.edu wrote: Can someone let me know what package and function should be used to read *.grd files in R? I tried readGDAL, open.ncdf functions already which threw errors for file format mismatch. Thank you all,

[R-sig-Geo] accessing raster::lineValues

2010-10-06 Thread Roman Luštrik
Recently, Robert kindly added a function to raster package (raster_1.5-14 from RForge) called lineValues. After loading the new package, I am unable to access (or use) the function. Any ideas what I might be doing wrong? rst.cln - raster::lineValues(lns = rst.lines, rst.cellnum) Error:

Re: [R-sig-Geo] custom reports

2010-10-01 Thread Roman Luštrik
You are looking for Sweave. This is LaTeX and R combined... sort of. You may find LyX handy (a GUI for LaTeX). Cheers, Roman On Fri, Oct 1, 2010 at 7:52 PM, Ricardo Rodríguez ricardorodo...@gmail.comwrote: hi all, how I can create reports with the results of my R scripts in pdf format, if

Re: [R-sig-Geo] suggestion to write a function

2010-09-13 Thread Roman Luštrik
I see nothing wrong with the suggested names, they appear to be valid. I would like to know how otheres deal with this, but I tend to keep parameter names short and sweet with very little extra finesse, e.g. capital letters. I even try to avoid dots (I have them reserved for objects, whereas

Re: [R-sig-Geo] Revolution R Enterprise - solution to handling large (spatial) data?

2010-09-10 Thread Roman Luštrik
Dear Tomislav, go for it if you can afford it (moot point if you're using it under academic license terms). Or, you can jump through a few hoops and get most of the things that is provided by RR (especially big data and parallel computing) through other resources. Have you seen Eclipse + StatET?

[R-sig-Geo] scoping issue with xyValues?

2010-08-26 Thread Roman Luštrik
I have a function (that is within a function and everything wrapped in a wrapper function) that uses raster::xyValues. When I run the wrapper function and try to pass xy arguments as a vector (of 2, as mentioned in the documentation), I get an error that the buffer argument (I call it

Re: [R-sig-Geo] SpatialGridDataFrame to SpatialPixelDataFrame

2010-08-25 Thread Roman Luštrik
Your df variable should have coordinates in it and in the form of a matrix or SpatialPoints (from ?SpatialGridDataFrame: points coordinates, either as numeric matrix or as object of class SpatialPoints-class). Based on the code you provided, I would guess that you have a few columns to spare, and

[R-sig-Geo] xyValues, S4 methods and the dreaded NA

2010-07-05 Thread Roman Luštrik
Dear List, I have a list of xy coordinates origin.point [[1]] x y 196 35.65648 4.268407 267 26.97161 -0.921370 [[2]] x y 2396 25.82682 -34.30095 2485 24.36276 -31.83600 ... and I'm tryig to extract raster cell values within the radius like so: cell.num

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

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

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

[R-sig-Geo] specific colors for specific cell values

2010-06-07 Thread Roman Luštrik
Dear List, I have a raster with a set of different values (about 8 in total) - they are all discrete values (sort of like factors, really) on a log scale (10, 1, 0.1...). For better visualization, I would like to assign a specific color to each value. I have tried with the plot argument col =

Re: [R-sig-Geo] Layer stack with R

2010-06-01 Thread Roman Luštrik
See package raster. stack() brick() Also some nice vignettes for the package. Cheers, Roman On Tue, Jun 1, 2010 at 3:15 PM, Conde Ovando, Dalia Amor co...@demogr.mpg.de wrote: Hi all, I am working with satellite images LANDSAT, and I am wondering if there is any way to do a layer

Re: [R-sig-Geo] circular holes in rectangular polygon

2010-05-27 Thread Roman Luštrik
I have found a function (kudos to Barry Rowlingson) on this mailing list that makes a circle. I have modified it to fit my needs. You can convert the points into a polygon. You should be able to clip your rectangle with that. circle - function(x = x, y = y, r = radius, n = n.faces){ t -

[R-sig-Geo] trying to plot listed RasterLayers

2010-05-14 Thread Roman Luštrik
I have created a list of RasterLayers and am trying to plot each layer individually by extracting it from a list. I get the error listed below. I have tried unlist() but it's not working for some reason. Can anyone suggest how to make it plot? plot(list.of.rasters[[1]][1]) Error in xy.coords(x,

[R-sig-Geo] raster sizes

2010-04-28 Thread Roman Luštrik
Hello, I have a general question regarding rasters from raster package. What sizes of rasters are usually employed in analyses? How would you classify a raster of 1000x1000 pixels, small, average, large, huge...? Cheers, Roman -- In God we trust, all others bring data. [[alternative

Re: [R-sig-Geo] Guam island map

2010-04-27 Thread Roman Luštrik
I've tried to plot a few islands off the west coast of Croatia (Yugoslavia in the dataset) and get a similar result. Perhaps it's the (relative small) size of these island polygons that is stirring up problems? Cheers, Roman On Tue, Apr 27, 2010 at 6:17 PM, Bin Li b...@lsu.edu wrote: I am

Re: [R-sig-Geo] assigning raster cell values based on predefined criteria

2010-04-23 Thread Roman Luštrik
Thank you Marcelino and Robert for your valuable input. It was helpful. Marcelino, your solution seems to resolve the issue, however I find Robert's suggestion easier (more compliant with the existing code I already have). What I would like to add to the discussion is that I set the projection of

Re: [R-sig-Geo] creating polygons of clusters of points?

2010-04-23 Thread Roman Luštrik
How does this function sound (convexhull.xy {spatstat})? http://bm2.genes.nig.ac.jp/RGM2/R_current/library/spatstat/man/convexhull.xy.html Convex Hull of Points Description Computes the convex hull of a set of points in two dimensions. Usage convexhull.xy(x, y=NULL) Arguments x vector of x

Re: [R-sig-Geo] assigning raster cell values based on predefined criteria

2010-04-22 Thread Roman Luštrik
This is the normal behavior (see image herehttp://imagepaste.nullnetwork.net/viewimage.php?id=837) when I use option A-ish (calculating distance to a single point). Intuitively, however, I would expect the plot to look something like this (crudely drawn for your

[R-sig-Geo] assigning raster cell values based on predefined criteria

2010-04-20 Thread Roman Luštrik
Dear list, I have a polygon that I converted to raster (kudos to polygonsToRaster()). I would like to assign values (through a custom function) to cells within this polygon (now as raster). Roughly speaking, cell value will depend on its distance from the central cell (polygon centroid). How

[R-sig-Geo] trying to add points to a raster

2010-04-13 Thread Roman Luštrik
# Dear list, # # I'm apologizing in advance if my question is rather basic, but I've # been banging my head against the wall over this all day and the # seismology department has already contacted me to stop it. # # I'm trying to add points (SpatialPointsDataFrame object r) to a # raster object