[R-sig-Geo] Projection question...

2010-11-11 Thread Jonathan Greenberg
Folks: Robert has a version of this email concerning the implementation in raster, but I'm wondering if there's something going on with rgdal or proj? Can anyone think of a reason why reprojecting a file of North America with the following projection info: "+proj=lcc +lat_1=50 +lat_2=50 +lat_0=5

[R-sig-Geo] Proper PROJ settings for lat-long?

2010-10-01 Thread Jonathan Greenberg
Folks: I have two sets of spatialpoints data, one that is in lat long which longitude ranging from -180 to 180, and another that ranges from 0 to 360. What are the appropriate proj settings for these two different datasets such that one can be properly reprojected to the other? I have: "++proj=

[R-sig-Geo] GDALinfo with unrecognized format...

2010-07-26 Thread Jonathan Greenberg
r-sig-geo'ers: Quick question: is there an easy way to have a flag to tell if a dataset is NOT supported, e.g. when GDALinfo(fname) is in error? I'd like something like "GDALinfo(fname)" to return "FALSE" if its an unsupported dataset type. Thanks! --j _

[R-sig-Geo] getValues() question

2010-07-09 Thread Jonathan Greenberg
r-sig-geo'ers and Robert: If I want to pull out the values of a raster into a dataframe, ignoring "masked" values, what is the quickest way to do this? I can use getValues() and "post-process" the output, but is there a way to skip every loading these masked values into a memory in the first plac

[R-sig-Geo] netCDF, raster(), and being memory-safe

2010-06-07 Thread Jonathan Greenberg
r-sig-geo'ers: Next in my barrage of questions -- what would be a memory-safe way of dealing with netCDF files via raster()? I understand that raster loads the entire netCDF band/file into memory when using raster(): u_wind_rasters=stack(u_wind_file,zvar='uwnd') or v_wind_raster=raster(v_wind_

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

2010-06-02 Thread Jonathan Greenberg
I've got a file and a mask (1s for "good data", NAs for "bad"), and I want to extract the cell values AND geographic coordinates of these cells into a data frame or vector that correspond to the locations where the mask is 1 -- what is the best practice for doing this? I can loop through each row/

[R-sig-Geo] Extracting a z-subset from a rasterStack object

2010-05-27 Thread Jonathan Greenberg
I'm thinking I'm missing something obvious -- if I want to make a new raster stack which is a subset of another raster stack, how do I go about doing this? Neither of these worked: data_sub=stack(data_stack,bands=c(10,20)) data_sub=stack(data_stack,index=c(10,20)) data_stack is a rasterStack of

[R-sig-Geo] raster() and mixed-projection/resolution files

2010-05-24 Thread Jonathan Greenberg
R-sig-geo'ers: Given two rasters of differing resolutions, extents, and cell sizes, what is the most efficient way to do some level of raster algebra on the files, e.g.: raster1=raster(file1) raster2=raster(file2) I would like to add raster1 + raster2 and have the output be the extent, cell size

Re: [R-sig-Geo] rgdal and grass rasters

2010-03-01 Thread Jonathan Greenberg
ss6 "enable" rgdal to access GRASS rasters, or is it >>> its own standalone program?  How does the base gdal package work with >>> grass rasters? >>> >>> --j >>> >>> On Mon, Mar 1, 2010 at 2:35 PM, Sarah Goslee wrote: >>>>

Re: [R-sig-Geo] rgdal and grass rasters

2010-03-01 Thread Jonathan Greenberg
Sarah > > On Mon, Mar 1, 2010 at 5:17 PM, Jonathan Greenberg > wrote: >> Folks: when trying to import or GDALinfo a grass raster, where, >> exactly, should I be pointing to in the grass directory?  I tried >> pointing to the file with the same name as the raster I want t

[R-sig-Geo] rgdal and grass rasters

2010-03-01 Thread Jonathan Greenberg
Folks: when trying to import or GDALinfo a grass raster, where, exactly, should I be pointing to in the grass directory? I tried pointing to the file with the same name as the raster I want to work with in the fcell, cellhd, and cell directories (grass/location/mapset), but none of these are worki

[R-sig-Geo] Vector to raster "zone" conversion...

2010-02-03 Thread Jonathan Greenberg
Rsiggeo'ers: Given a vector file containing polygons and a raster file of the same projection, I would like to create raster "zones" based on the polygons -- e.g. I would like to rasterize the vector polygon at the resolution of the raster. I'm not seeing any obvious way to do this -- any

Re: [R-sig-Geo] decimate points from a Lidar file

2009-09-09 Thread Jonathan Greenberg
Michael: Typically Lidar files come "tiled", e.g. you get a set of point clouds pre-subsetted to, say, 1km x 1km window. These subsetted data are usually a LOT easier to write some batch scripts to deal with than trying to analyze the entire database at once. Have you seen if the source

[R-sig-Geo] Dumping OGR database to dataframe(s)?

2009-08-03 Thread Jonathan Greenberg
R-sig-geo'ers: I'm pushing forward with recoding starspan as a set of R functions so we can get the program back on track after a long hiatus with the development of a C version (I don't know C and don't have time to learn it, and we lost our master programmer who did know C), and I'm tryin

[R-sig-Geo] Polygon to raster?

2009-08-02 Thread Jonathan Greenberg
I'm trying to hunt down a function that will take a polygon (derived from a shapefile) and "rasterize" it at a given pixel resolution -- any hints? --j -- Jonathan A. Greenberg, PhD Postdoctoral Scholar Center for Spatial Technologies and Remote Sensing (CSTARS) University of California, Davi

Re: [R-sig-Geo] [R] strata -- really slow performance

2009-07-12 Thread Jonathan Greenberg
hen adding 1 to each element to get 661 1's. Why not use: rep(1, length(uniqueids)) " --> Learn something new every day! Wasn't familiar with the rep() function, so I got my vector of 1s the only way I currently knew how! Marc Schwartz wrote: On Jul 11, 2009, at 8:42 PM,

Re: [R-sig-Geo] How do I set ENVI file interleave when using GDALTransientDataset?

2009-07-10 Thread Jonathan Greenberg
e writeBin statements to realize tiled processing). --j Roger Bivand wrote: On Thu, 9 Jul 2009, Jonathan Greenberg wrote: I'm writing a function to mimic ENVI/IDL's "ENVI_SETUP_HEAD" using rgdal, and I was wondering how I set the interleave (BIP vs BSQ vs BIL)? You

[R-sig-Geo] More questions on setting up ENVI headers...

2009-07-09 Thread Jonathan Greenberg
R-sig-geo'ers: I am using the following code to create an ENVI header: driver="ENVI" d.drv <- new("GDALDriver", driver) tds.out <- new("GDALTransientDataset", driver = d.drv, rows = dims[2],cols = dims[1], bands = bands, type = type) gt <- c(offset[1] - 0.5 * cellsize[1], cellsize[1

[R-sig-Geo] How do I set ENVI file interleave when using GDALTransientDataset?

2009-07-09 Thread Jonathan Greenberg
I'm writing a function to mimic ENVI/IDL's "ENVI_SETUP_HEAD" using rgdal, and I was wondering how I set the interleave (BIP vs BSQ vs BIL)? The subsection of my code that I assume this belongs in is below: driver="ENVI" d.drv <- new("GDALDriver", driver) tds.out <- new("GDALTransientD

Re: [R-sig-Geo] (no subject)

2009-04-08 Thread Jonathan Greenberg
It seems that a raster-based approach would make more sense, rather than the hugely computationally inefficient approach you are suggesting -- how about using a least cost path or euclidean distance approach? Both are available in many GIS packages (ArcMap, GRASS GIS, etc...) --j x wong wrot

[R-sig-Geo] Wiki?

2009-02-19 Thread Jonathan Greenberg
R-sig-geo'ers -- do we have a wiki/script repository? If not, can we start a r-sig-geo wiki subpage on one of the main R wiki sites (http://wiki.r-project.org/rwiki/doku.php)? It would be nice to have a centralized location to paste help and/or scripts that we develop. --j -- Jonathan A. G

Re: [R-sig-Geo] Vector to raster?

2009-02-15 Thread Jonathan Greenberg
: > rsaga.get.usage(lib="grid_gridding", 3) SAGA CMD 2.0.3 library path: C:/Progra~1/saga_vc/modules library name: grid_gridding module name : Shapes to Grid ... But before SAGA, you need to reproject the polygons first (if necessary). see also some examples from: http://spati

Re: [R-sig-Geo] Vector to raster?

2009-02-14 Thread Jonathan Greenberg
4/2009 10:07 PM To: Jonathan Greenberg Cc: r-sig-geo@stat.math.ethz.ch Subject: Re: [R-sig-Geo] Vector to raster? Jonathan Greenberg schreef: > How do I take a polygon in some OGR supported vector layer (say, a > shapefile), and rasterize it given a pixel size and projection/datum? >

[R-sig-Geo] Vector to raster?

2009-02-14 Thread Jonathan Greenberg
How do I take a polygon in some OGR supported vector layer (say, a shapefile), and rasterize it given a pixel size and projection/datum? --j -- Jonathan A. Greenberg, PhD Postdoctoral Scholar Center for Spatial Technologies and Remote Sensing (CSTARS) University of California, Davis One Shield

[R-sig-Geo] Open source GIS cataloging software?

2009-02-11 Thread Jonathan Greenberg
Sorry for the cross-posting. I was wondering if anyone has a unix (preferably) or windows program that can spider a directory, recursively searching for raster and vector data, and create bounding box polygons for each raster/vector it finds, with attributes indicating the path-to-file. Thank

Re: [R-sig-Geo] Problems freeing rgdal driver...

2009-02-10 Thread Jonathan Greenberg
ght away; for some reason. If you omit GDAL.close(d.drv) It will work. Robert On Wed, Feb 11, 2009 at 7:32 AM, Jonathan Greenberg wrote: A few months back I was getting some help with adapting R for doing tiled processing of remote sensing data, and I made some serious headway, but there is

[R-sig-Geo] Problems freeing rgdal driver...

2009-02-10 Thread Jonathan Greenberg
A few months back I was getting some help with adapting R for doing tiled processing of remote sensing data, and I made some serious headway, but there is a lingering problem I keep scratching my head at. First off, a quick recap of the base algorithm: 1) Let i = input raster, f() some functi

[R-sig-Geo] Vector to raster conversion...

2009-01-30 Thread Jonathan Greenberg
Question: If I have a polygon shapefile, and I want to rasterize each polygon given a certain grid cell resolution, is there a way to do this completely within R? I'm considering porting our vector<->raster bridge "starspan" (http://starspan.casil.ucdavis.edu/doku/doku.php) to R code, but

Re: [R-sig-Geo] Coercing multiband readGDAL objects to a matrix/vector...

2009-01-23 Thread Jonathan Greenberg
On Fri, 23 Jan 2009 8:59:02 +1100 Jonathan Greenberg wrote: I was hoping I could get some info on how to coerce the type of object readGDAL produces, assuming its a multiband object, into an R matrix (I just want the raster values in the matrix)? Thanks! --j

[R-sig-Geo] Coercing multiband readGDAL objects to a matrix/vector...

2009-01-22 Thread Jonathan Greenberg
I was hoping I could get some info on how to coerce the type of object readGDAL produces, assuming its a multiband object, into an R matrix (I just want the raster values in the matrix)? Thanks! --j -- Jonathan A. Greenberg, PhD Postdoctoral Scholar Center for Spatial Technologies and Remote

[R-sig-Geo] Using RGDAL to "copy" header information...

2008-11-05 Thread Jonathan Greenberg
R-geographers... I'm trying to solve a problem to implement a line-by-line tiled processing using RGDAL (read 1 line of an image, process the one line, write one line of the image to a binary file). Everything except for the final step I'm able to do using a combination of RGDAL and r-base c

Re: [R-sig-Geo] Tiled processing...

2008-10-30 Thread Jonathan Greenberg
(currently) depends on Windows, uses SAGA's grid calculator. SAGA is able to process large grids efficiently. E.g.: # first convert the ASCII grid to a SAGA grid (.sgrd): rsaga.esri.to.sgrd("ingrid") rsaga.grid.calculus("ingrid", "outgrid", formula = "a+1000&

[R-sig-Geo] Tiled processing...

2008-10-29 Thread Jonathan Greenberg
I've recently got back into using R to perform spatial analyses, and I'm trying to figure out how to perform "true" tiled processing, e.g. controlled reading of subsets of an input file, performing a function on this subset, and writing the output, subset by subset, to an output file and, final

Re: [R-sig-Geo] comparing raster and vector data with Grass/R

2007-03-07 Thread Jonathan Greenberg
Our primary developer for starspan (I designed the program, but did none of the coding) has since moved on to bigger and better things, but I would LOVE to get some help getting starspan cleaned up so it can be a GRASS add-on. If anyone is interested, please send me an email about it -- ultimately

Re: [R-sig-Geo] Failure to install spgrass6

2006-09-10 Thread Jonathan Greenberg
ving it would lead to a segfault, but I still > would have thought you'd need it to avoid it trying to find a binary > package for the Mac (at least, that's my experience on my G5). > > On 10 Sep 2006, at 0:40, Jonathan Greenberg wrote: > >> I'm getting this erro

[R-sig-Geo] Failure to install spgrass6

2006-09-09 Thread Jonathan Greenberg
I'm getting this error while trying to install spgrass6 on a dual G5/2ghz w 4gb ram, and macos x 10.4.7: > rS <- "http://r-spatial.sourceforge.net/R"; > install.packages("spgrass6", repos=rS, dependencies=TRUE) *** caught segfault *** address 0x5f4d4550, cause 'memory not mapped' Traceback: 1:

Re: [R-sig-Geo] [R-SIG-Mac] Problems installing rgdal from source

2006-09-09 Thread Jonathan Greenberg
I am going through some similar problems getting rgdal running on macos x: sudo ./usr/local/bin/R64 CMD INSTALL --configure-args='--with-proj-include=/usr/local/include --with-proj-lib=/usr/local/lib' rgdal ... checking proj_api.h usability... yes checking proj_api.h presence... yes checking for

[R-sig-Geo] GRASS and R question

2006-09-09 Thread Jonathan Greenberg
I was wondering if I could get some brief feedback on exactly what are the capabilities of the sp and spgrass6 -- say I'd like to use R to calculate and NDVI image (I know GRASS's mapcalc can do this fine, but I'm thinking of some more complicated analyses that aren't easily performed in R and I fi