Re: [R-sig-Geo] Population weighted Centroids?

2012-03-06 Thread Barry Rowlingson
On Tue, Mar 6, 2012 at 1:49 AM, Zia Ahmed wrote: > Is there anyway to calculate population weighted centroids of a spatial > polygon   in R? Any idea will be appreciated. Thanks Some more clues would be appreciated! What's your data? A set of points representing cities with populations and an ad

[R-sig-Geo] Projection of a shapefile

2012-03-06 Thread Ester Polaina Lacambra
Hello everyone, This is going to sound quite silly, but I'm an amateur R user and after a while I haven't been able to find the solution for my problem... I've got a shapefile coming from ArcMap 10, with a Projected Coordinate System: World_Cylindrical_Equal_Area (I chose that one when I was measu

Re: [R-sig-Geo] Projection of a shapefile

2012-03-06 Thread Raphael Saldanha
Hi! Is there some file with same name of the shapefile, but with the prj extension? On Tue, Mar 6, 2012 at 10:08 AM, Ester Polaina Lacambra wrote: > Hello everyone, > > This is going to sound quite silly, but I'm an amateur R user and after a > while I haven't been able to find the solution for

Re: [R-sig-Geo] Projection of a shapefile

2012-03-06 Thread Roger Bivand
On Tue, 6 Mar 2012, Ester Polaina Lacambra wrote: Hello everyone, This is going to sound quite silly, but I'm an amateur R user and after a while I haven't been able to find the solution for my problem... I've got a shapefile coming from ArcMap 10, with a Projected Coordinate System: World_Cyli

[R-sig-Geo] Using "Mask" for SDMs (Maxent) with Dismo

2012-03-06 Thread Johannes Radinger
Hi, I have several environmental rasters (loaded as stack/brick) in R which I want to use as predictors for Species Distribution Models (preferably Maxent) with the dismo-package. Some of the predictors are habitat specific variables and are restricted to a river (like a line of raster cells, a

Re: [R-sig-Geo] Using "Mask" for SDMs (Maxent) with Dismo

2012-03-06 Thread Rafael Wüest
Hi Johannes, On 06.03.2012, at 14:45, Johannes Radinger wrote: > Hi, > > I have several environmental rasters (loaded as stack/brick) in R which I > want to use as predictors for Species Distribution Models (preferably Maxent) > with the dismo-package. Some of the predictors are habitat specif

[R-sig-Geo] Getting a new raster layer without the values of region shapefile

2012-03-06 Thread Camille Leclerc
Hi everybody,   My problem is this : I have a raster layer of world temperature and I have also a shapefile representing a region of the world. I want obtain a new raster layer of world temperature without the values at region shapefile. Thank for your help, Camille Leclerc -

[R-sig-Geo] writeRaster and coord ref problem

2012-03-06 Thread Johannes Radinger
Hi, I need to load some data from the Worldclim Database and reproject them to some other, already existing rasters. Because I don't want to use the reprojected rasters from the memory I want to save the brick as a GeoTiff (like the other rasters) using writeRaster. But somehow writeRaster() cha

Re: [R-sig-Geo] spplot handling of overlapping points?

2012-03-06 Thread Mauricio Zambrano-Bigiarini
On 05/03/12 14:40, Edzer Pebesma wrote: This has now been changed/repared in sp on r-forge (svn), and will appear from sp 0.9-97 on. A test run would be: library(sp) xyz = data.frame(expand.grid(x=1:10,y=1:10),rnorm(100)) coordinates(xyz)=~x+y spplot(xyz, cex=10) which used to plot points in va

Re: [R-sig-Geo] subset() for spatialPointsDataFrame

2012-03-06 Thread Samuel Turgeon
Hi Johannes, did you transform your SpatialPointsDataFrame to a regular data.frame? point.df=data.frame(point.spdf) subset(points.df, points.df[,"value"] > 0 , select = c(1, 2)) coordinates(points.df) = ~X + Y ##You should keep those columns (X,Y) in the subset command in order to backtransform t

[R-sig-Geo] subset() for spatialPointsDataFrame

2012-03-06 Thread Johannes Radinger
Hi, I just wanted to know how I have to use the subset() command for a SpatialPointsDataFrame correctly. I'd like to get all records of the SpatialPointsDataFrame where the column "value" is > 0. Furthermore I want to select only two columns of that dataframe with these records. The subset com

Re: [R-sig-Geo] spplot handling of overlapping points?

2012-03-06 Thread Edzer Pebesma
Yes, look for argument alpha e.g. in ?rgb or ?bpy.colors On 03/06/2012 04:49 PM, Mauricio Zambrano-Bigiarini wrote: > On 05/03/12 14:40, Edzer Pebesma wrote: >> This has now been changed/repared in sp on r-forge (svn), and will >> appear from sp 0.9-97 on. A test run would be: >> >> library(sp) >>

Re: [R-sig-Geo] trouble with writeOGR

2012-03-06 Thread Samuel Turgeon
Hi Erin, I don't know if you fix your problem yet but I had the same error yesterday and the problem is that ArcGIS do not accept the caracter "." in a field name.. hope this helps Sam On Thu, Mar 1, 2012 at 9:38 PM, Hodgess, Erin wrote: > Hi R Sig Geo People: > > I'm having some trouble with

Re: [R-sig-Geo] subset() for spatialPointsDataFrame

2012-03-06 Thread Johannes Radinger
Hi, Original-Nachricht > Datum: Tue, 6 Mar 2012 10:53:11 -0500 > Von: Samuel Turgeon > An: Johannes Radinger > CC: r-sig-geo@r-project.org > Betreff: Re: [R-sig-Geo] subset() for spatialPointsDataFrame > Hi Johannes, > > did you transform your SpatialPointsDataFrame to a regu

Re: [R-sig-Geo] spplot handling of overlapping points?

2012-03-06 Thread Mauricio Zambrano-Bigiarini
On 06/03/12 16:55, Edzer Pebesma wrote: Yes, look for argument alpha e.g. in ?rgb or ?bpy.colors Thank you very much Edzer. It works perfectly: library(sp) xyz = data.frame(expand.grid(x=1:10,y=1:10),rnorm(100)) coordinates(xyz)=~x+y spplot(xyz, cex=10, alpha=0.7) Cheers, Mauricio -- ==

Re: [R-sig-Geo] subset() for spatialPointsDataFrame

2012-03-06 Thread Tom Gottfried
Am 06.03.2012 16:53, schrieb Samuel Turgeon: Hi Johannes, did you transform your SpatialPointsDataFrame to a regular data.frame? point.df=data.frame(point.spdf) subset(points.df, points.df[,"value"]> 0 , select = c(1, 2)) Indexing with the correct number of dimensions as done here (in contra

Re: [R-sig-Geo] writeRaster and coord ref problem

2012-03-06 Thread Robert J. Hijmans
Johannes, it works for me: library(raster) crs <- "+proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=350 +y_0=0 +datum=potsdam +units=m +no_defs +ellps=bessel +towgs84=606.0,23.0,413.0" r <- raster(nc=10, nr=10, crs=crs) r[] <- 1:ncell(r) b <- brick(r,r,r) x <- writeRaster(b, 'datum.tif', overwrite=TRUE

[R-sig-Geo] spplot with legend only, and legend inside the plotting area

2012-03-06 Thread Mauricio Zambrano-Bigiarini
Hi all, I need to produce two different spplot figures of spatial points, and I would like to ask your help for the creation of the second one: 1) the first figure has to show the values but without any legend: library(sp) xyz = data.frame(expand.grid(x=1:10,y=1:10),rnorm(100)) coordinates(x

Re: [R-sig-Geo] Using "Mask" for SDMs (Maxent) with Dismo

2012-03-06 Thread Robert J. Hijmans
Johannes, On Tue, Mar 6, 2012 at 5:45 AM, Johannes Radinger wrote: > Hi, > > I have several environmental rasters (loaded as stack/brick) in R which I > want to use as predictors for Species Distribution Models (preferably > Maxent) with the dismo-package. Some of the predictors are habitat spec

Re: [R-sig-Geo] Getting a new raster layer without the values of region shapefile

2012-03-06 Thread Robert J. Hijmans
Camille, I do not understand your question, but the problem can probably be solved with 'rasterize', perhaps with argument mask=TRUE or update=TRUE Best, Robert On Tue, Mar 6, 2012 at 6:30 AM, Camille Leclerc wrote: > Hi everybody, > > My problem is this : I have a raster layer of world tempera

[R-sig-Geo] error reading ncdf files

2012-03-06 Thread sajid pareeth
Hi I am getting the following error when trying to read and stack a .nc file. PJ <- stack("2030-2060-Tmax.nc",varname="TASMAX") Warning message:In .stackCDF(x, varname = varname, bands = bands) : TASMAXhas 4 dimensions, I do am using the last one PJ [1] "TASMAXhas 4 dimensions, I do am usi

Re: [R-sig-Geo] error reading ncdf files

2012-03-06 Thread Robert J. Hijmans
Sajid, You are not getting an error (it is a warning), and you are not saying what you want to achieve, that makes it hard to say how you can "handle this"? For efficiency, you should probably use 'brick' rather than 'stack' when using a single ncdf file. You can use the can use lvar argument to

Re: [R-sig-Geo] adjusting and moving scale

2012-03-06 Thread Kanika Jhunjhnuwala
Yes perfect thanks. -Original Message- From: r-sig-geo-boun...@r-project.org [mailto:r-sig-geo-boun...@r-project.org] On Behalf Of Edzer Pebesma Sent: Tuesday, 6 March 2012 7:56 p.m. To: r-sig-geo@r-project.org Subject: Re: [R-sig-Geo] adjusting and moving scale Kanika, maybe something a

[R-sig-Geo] simple return calculation on getSymbols data

2012-03-06 Thread mark allen
Hi all R gurus, I'm trying to produce simple returns on a series of market prices but am receiving zeros, even when using the formula directly. The timeSeries function "returns" is the only method, of the methods that I've tried, that works for me. My preference is to use PerformanceAnalytics "Ret

[R-sig-Geo] Creating a Shapefile from a List of Polygons

2012-03-06 Thread Benjamin Stewart
I feel like I have done this before, so I am sorry if I have made a stupid mistake, however, I am out of ideas. I am trying to make a shapefile out of a list of polygons. I want to include the a data frame as well, but I can't seem to create a SpatialPolygons-Class longer than one object. The one

Re: [R-sig-Geo] error reading ncdf files

2012-03-06 Thread sajid pareeth
Dear Robert Thanks for the reply.. Yes I should have explained more. Actually I want to subset certain bands representing seasonal months to create rasters and followed by summary stats. I was not able to subset with those warnings. But your tip on using brick instead of stack worked and now the