Re: [R-sig-Geo] stplot question

2013-03-05 Thread Edzer Pebesma
Erin, See the help of xyplot in package lattice, in particular argument
layout.

On 03/05/2013 08:21 AM, Hodgess, Erin wrote:
 Hello!
 
 I have a spatio-temporal data set with 23 cities and 11 years of annual data.
 
 I have made it through krigeST without any problem.
 
 I use stplot and it works fine.  It puts all of the plots on one page.
 
 My question:  is there a way to have each of the stplots on separate pages, 
 please?
 
 Thanks,
 Erin
 
 
   [[alternative HTML version deleted]]
 
 ___
 R-sig-Geo mailing list
 R-sig-Geo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-geo
 

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics  e.pebe...@wwu.de

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] stplot question

2013-03-05 Thread Hodgess, Erin
Thank you!

I have:

stplot(kr3, layout=c(0,11))

Now, of course, one more thing, please:  the plots run one after another.  Is 
there a way to do one at a time, please?  My ideal is to have 11 png files.

Thanks again,
Erin


From: r-sig-geo-boun...@r-project.org [r-sig-geo-boun...@r-project.org] on 
behalf of Edzer Pebesma [edzer.pebe...@uni-muenster.de]
Sent: Tuesday, March 05, 2013 2:12 AM
To: r-sig-geo@r-project.org
Subject: Re: [R-sig-Geo] stplot question

Erin, See the help of xyplot in package lattice, in particular argument
layout.

On 03/05/2013 08:21 AM, Hodgess, Erin wrote:
 Hello!

 I have a spatio-temporal data set with 23 cities and 11 years of annual data.

 I have made it through krigeST without any problem.

 I use stplot and it works fine.  It puts all of the plots on one page.

 My question:  is there a way to have each of the stplots on separate pages, 
 please?

 Thanks,
 Erin


   [[alternative HTML version deleted]]

 ___
 R-sig-Geo mailing list
 R-sig-Geo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-geo


--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics  e.pebe...@wwu.de

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] stplot question

2013-03-05 Thread Edzer Pebesma
Erin, if you don't specify the filename argument of the png file but
leave it to the default value, you will end up with

Rplot001.png
Rplot002.png
...
Rplot011.png

See how the default is constructed to understand how you can modify this
to your taste.

On 03/05/2013 09:39 AM, Hodgess, Erin wrote:
 Thank you!
 
 I have:
 
 stplot(kr3, layout=c(0,11))
 
 Now, of course, one more thing, please:  the plots run one after another.  Is 
 there a way to do one at a time, please?  My ideal is to have 11 png files.
 
 Thanks again,
 Erin
 
 
 From: r-sig-geo-boun...@r-project.org [r-sig-geo-boun...@r-project.org] on 
 behalf of Edzer Pebesma [edzer.pebe...@uni-muenster.de]
 Sent: Tuesday, March 05, 2013 2:12 AM
 To: r-sig-geo@r-project.org
 Subject: Re: [R-sig-Geo] stplot question
 
 Erin, See the help of xyplot in package lattice, in particular argument
 layout.
 
 On 03/05/2013 08:21 AM, Hodgess, Erin wrote:
 Hello!

 I have a spatio-temporal data set with 23 cities and 11 years of annual data.

 I have made it through krigeST without any problem.

 I use stplot and it works fine.  It puts all of the plots on one page.

 My question:  is there a way to have each of the stplots on separate pages, 
 please?

 Thanks,
 Erin


   [[alternative HTML version deleted]]

 ___
 R-sig-Geo mailing list
 R-sig-Geo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-geo

 
 --
 Edzer Pebesma
 Institute for Geoinformatics (ifgi), University of Münster
 Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
 8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
 http://www.52north.org/geostatistics  e.pebe...@wwu.de
 
 ___
 R-sig-Geo mailing list
 R-sig-Geo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-geo
 

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics  e.pebe...@wwu.de

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[R-sig-Geo] Transform 2or 3 raster with texture information in soil triangle classes.

2013-03-05 Thread Swen Meyer

Dear All,
does anyone maybe know a R script or a software tool that transforms a 
set of texture rasters (sand , silt , caly) into one classified raster 
according the German triangle ‘‘Bodenkundliche Kartieranleitung 1994. I 
know that SAGA GIS does have such a function but I think the results are 
classified according the USDA classification.

Thank you in advance,
Swen

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[R-sig-Geo] Spatial interpolation of rainfall timeseries with e.g. spacetime

2013-03-05 Thread Fabian Ries
Dear all,

I work on rainfall-runoff processes in a semi-arid area. I have time
series of about 15 rainfall stations within a small area (300 sqkm) and
want to perform spatial interpolation (idw or kriging) on a 5min-timestep.
Runoff processes respond in my research area often to short peaks of
rainfall intensity - therefore I need to work on this short time
intervals. 

First I would like to perform spatial interpolation on a 5 min time step
but exclude time intervals with no rain so I receive a data set with about
5000 time steps for a single year.
Second I want to build sums of hourly, daily, monthly and yearly rainfall
on a grid base to apply water balance calculations.
Finally I want to create a regular time series of mean rainfall over my
watersheds on the 5 min time steps by the use of spatial polygons.

In the beginning I tried to realize simple IDW interpolation considering
the time steps with rainfall in a for-loop but I get stuck in the
aggregation step for hourly, daily, ... rainfall because of the time gaps
in my data deleting the no rain time steps.
Then I found the package spacetime which seems to offer exactly the
functionality I need. Following the Ireland wind example I could not
understand how to modify the example with kriging using simple IDW method.
Can someone give me a hint how to apply IDW over a spatial time series?

I had also problems applying extract(grid, raster, fun=mean) on
spatialpolygonsdataframe and spatialgriddataframe. Is it only working for
the class spatialpolygons?
I import my polygons by using readOGR(Š) and the raster by
read.asciigrid(Š).

The rainfall data I use has the following format:

Station Station01   Station02   Station03   Station04   
Station05   Station06   Station
07  Station08   Station09
PosX18  195900  181950  192150  179550  176750  182950  170400  173100
PosY157550  150950  154550  141650  154700  157050  158450  147800  133500
01.03.2012 00:050   0   0   0   0   0   0.0 
0.2 0.2
01.03.2012 00:100   0   0   0   0   0   0.0 
0   0.1
01.03.2012 00:150   0   0   0   0   0   0.0 
0.4 0.1
01.03.2012 00:200.2 0   0   0   0.2 0   0.0 
0.2 0.1
01.03.2012 00:250.2 0   0.2 0   0.4 0.4 0.2 
0.4 0.1
01.03.2012 00:300   0   0.4 0   0.4 0.2 0.4 
0.6 0.1
01.03.2012 00:350.2 0   0.2 0   0.2 0.2 0.2 
0.6 0.1
01.03.2012 00:400.2 0   0.2 0   0.4 0.2 0.2 
0.8 0.0
01.03.2012 00:450   0   0.4 0   0.4 0.4 0.4 
0.4 0.0
01.03.2012 00:500.2 0   0.4 0   0.2 0.2 0.4 
0.2 0.0
01.03.2012 00:550.2 0   0   0   0.6 0.2 0.0 
0.2 0.0
01.03.2012 01:000   0   0.4 0   0.2 0.2 0.4 
0.2 0.1
01.03.2012 01:050.2 0   0.2 0   0.2 0.2 0.2 
0   0.1
01.03.2012 01:100.2 0   0.2 0   0.2 0.2 0.2 
0   0.0
01.03.2012 01:150   0   0   0   0.2 0.4 0.0 
0   0.0
01.03.2012 01:200   0   0.2 0   0   0   0.2 
0   0.0
01.03.2012 01:250   0   0   0   0.2 0.2 0.0 
0   0.0
01.03.2012 01:300   0   0   0   0   0   0.0 
0   0.0
01.03.2012 01:350.2 0   0   0   0   0   0.0 
0   0.0
01.03.2012 01:400   0   0   0   0   0   0.0 
0   0.0
01.03.2012 01:450   0   0   0   0   0   0.0 
0   0.0
01.03.2012 01:500   0   0   0   0   0   0.0 
0   0.0
01.03.2012 01:550   0   0   0   0   0   0.0 
0   0.0
01.03.2012 02:000   0   0   0   0   0   0.0 
0   0.0


Any help is kindly appreciated.
Best regards
Fabian

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[R-sig-Geo] Directional correlograms

2013-03-05 Thread Subodh Acharya
Hi everyone, I think this question has been asked previously as well, but I
could not find the answer.
Can someone show me how I can calculate directional correlograms using any
spatial statistics package in R?
Thanks in advance for your help.

S-

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[R-sig-Geo] creating a SGDF with transformed coordinates and spatial aggregation

2013-03-05 Thread Swagath Navin
Dear all,

I have a large data frame in form of (Lon, Lat, Value) ((coordinates in 
EPSG:3035). I can convert the data frame into a object of class SGDF 
using the following commands:

coordinates(df)=~x+y
proj4string(df)=CRS(+init=epsg:3035)
gridded(pts) = TRUE
fullgrid(pts)=TRUE

getGridTopology(df)

  x   y
cellcentre.offset 2638500 1430500
cellsize 50005000
cells.dim 664 797

However, when i transform the coordinates to EPSG:4326 and then try to 
convert it to a SGDF, i get the following error:

coordinates(df)=~x+y
proj4string(df)=CRS(+init=epsg:3035)
pts = spTransform(df,CRS(+init=epsg:4326))
gridded(df) = TRUE

suggested tolerance minimum: 0.154774
Error in points2grid(points, tolerance, round) :
   dimension 1 : coordinate intervals are not constant

Any ideas, how i can obtain a regular grid.

And off-course a reproducible example:

x=c(5013500, 5018500, 4883500, 4888500, 4893500, 4898500, 4908500, 
4948500, 4953500, 4958500, 4963500, 4973500, 4978500, 4988500, 5008500, 
5013500, 5028500, 4878500, 4883500, 4888500, 4893500, 4898500, 4903500, 
4928500, 4963500, 4968500, 4973500, 4978500, 4983500, 4988500)

y=c(5395500, 5395500, 5390500, 5390500, 5390500, 5390500, 5390500, 
5390500, 5390500, 5390500, 5390500, 5390500, 5390500, 5390500, 5390500, 
5390500, 5390500, 5385500, 5385500, 5385500, 5385500, 5385500, 5385500, 
5385500, 5385500, 5385500, 5385500, 5385500, 5385500, 5385500)

z=c(1.74, 1.74, 1.82, 1.82, 1.82, 1.81, 1.81, 1.78, 1.77, 1.77, 1.76, 
1.76, 1.75, 1.74, 1.73, 1.73, 1.72, 1.82, 1.82, 1.81, 1.81, 1.80, 1.80, 
1.78, 1.75, 1.75, 1.74, 1.74, 1.73, 1.73)

df1=data.frame(x,y,z)
coordinates(df1) - c(x, y)
proj4string(df1)=CRS(+init=epsg:3035)
df1 = spTransform(df1,CRS(+init=epsg:4326))

gridded(df1)=TRUE
suggested tolerance minimum: 0.311581
Error in points2grid(points, tolerance, round) :
   dimension 1 : coordinate intervals are not constant

And with the example data, the spatial resolution is 5 km * 5 km and i 
would like to aggregate  to 15*15 km. The new cellsize would be now an 
average of the corresponding values in 3*3 cells. Also what to do if 
come grid cells contain NA. I would be thankful if people could provide 
some ideas on how to get around this.

Thanks a lot for your time.

Navin

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[R-sig-Geo] creating a SGDF with transformed coordinates and spatial aggregation

2013-03-05 Thread Swagath Navin

Sorry..i am resending my mail again ..first mail i sent as HTML format
Dear all,

I have a large data frame in form of (Lon, Lat, Value) ((coordinates in 
EPSG:3035). I can convert the data frame into a object of class SGDF 
using the following commands:


coordinates(df)=~x+y
proj4string(df)=CRS(+init=epsg:3035)
gridded(pts) = TRUE
fullgrid(pts)=TRUE

getGridTopology(df)

 x   y
cellcentre.offset 2638500 1430500
cellsize 50005000
cells.dim 664 797

However, when i transform the coordinates to EPSG:4326 and then try to 
convert it to a SGDF, i get the following error:


coordinates(df)=~x+y
proj4string(df)=CRS(+init=epsg:3035)
pts = spTransform(df,CRS(+init=epsg:4326))
gridded(df) = TRUE

suggested tolerance minimum: 0.154774
Error in points2grid(points, tolerance, round) :
  dimension 1 : coordinate intervals are not constant

Any ideas, how i can obtain a regular grid.

And off-course a reproducible example:

x=c(5013500, 5018500, 4883500, 4888500, 4893500, 4898500, 4908500, 
4948500, 4953500, 4958500, 4963500, 4973500, 4978500, 4988500, 5008500, 
5013500, 5028500, 4878500, 4883500, 4888500, 4893500, 4898500, 4903500, 
4928500, 4963500, 4968500, 4973500, 4978500, 4983500, 4988500)


y=c(5395500, 5395500, 5390500, 5390500, 5390500, 5390500, 5390500, 
5390500, 5390500, 5390500, 5390500, 5390500, 5390500, 5390500, 5390500, 
5390500, 5390500, 5385500, 5385500, 5385500, 5385500, 5385500, 5385500, 
5385500, 5385500, 5385500, 5385500, 5385500, 5385500, 5385500)


z=c(1.74, 1.74, 1.82, 1.82, 1.82, 1.81, 1.81, 1.78, 1.77, 1.77, 1.76, 
1.76, 1.75, 1.74, 1.73, 1.73, 1.72, 1.82, 1.82, 1.81, 1.81, 1.80, 1.80, 
1.78, 1.75, 1.75, 1.74, 1.74, 1.73, 1.73)


df1=data.frame(x,y,z)
coordinates(df1) - c(x, y)
proj4string(df1)=CRS(+init=epsg:3035)
df1 = spTransform(df1,CRS(+init=epsg:4326))

gridded(df1)=TRUE
suggested tolerance minimum: 0.311581
Error in points2grid(points, tolerance, round) :
  dimension 1 : coordinate intervals are not constant

And with the example data, the spatial resolution is 5 km * 5 km and i 
would like to aggregate  to 15*15 km. The new cellsize would be now an 
average of the corresponding values in 3*3 cells. Also what to do if 
come grid cells contain NA. I would be thankful if people could provide 
some ideas on how to get around this.


Thanks a lot for your time.

Navin

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[R-sig-Geo] Topographical Data SOS

2013-03-05 Thread Christine Lynn Mc Lauchlan
Hey R SIG GEO folks,

I'm an amateur R user, and have been trying to make a topographical map of
Nova Scotia, Canada, on and off for the past month (with little success). I
can make a two dimensional map simply using base R, but I'd like to get
some sort of heat/contour map with elevation. I'm curious if anyone out
there has any ideas on where I should start.

Thank you kindly for your time,

Christine McLauchlan
M.Sc. Candidate, Acadia University
cmclauch...@upei.ca

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] raster::crop() can fail when cropped region is too large to process in memory.

2013-03-05 Thread Josh O'Brien
Robert Hijmans wrote
 Josh,
 
 Thanks for reporting this, I will make 'crop' more conservative. The
 easiest way to deal with this (I believe rare) problem is to change the
 default setting of maxmemory:
 
 rasterOptions(maxmemory=1e+07)
 
 After that,
 
 crop(r, E, filename=smallerRast)
 
 will likely run without a problem (although I cannot know for sure).
 
 Robert

Robert,

Thanks! I can confirm that setting maxmemory to 1e7 solves the problem.

I believe that you may want to up n in canProcessInMemory, to n=5 (rather
than n=4).  With a bit of poking around, I found cases in which crop will
fail even when canProcessInMemory(out, 4) -- TRUE, but wherever
canProcessInMemory(out, 5) -- TRUE, the operation succeeds.

Here's an example where crop fails when canProcessInMemory(out, 4) -- TRUE:

r - raster(bigRast)
E - extent(c(-179, 179, -89, 69))
crop(r, E, filename=smallerRast) 

In my use case, editing crop() to use canProcessInMemory(out, 5) made
everything run smoothly, whereas one in five or so of cropping operations
were failing when I used the default.

Thanks for all of your work on this remarkable package,

Josh 



--
View this message in context: 
http://r-sig-geo.2731867.n2.nabble.com/raster-crop-can-fail-when-cropped-region-is-too-large-to-process-in-memory-tp7582954p7582968.html
Sent from the R-sig-geo mailing list archive at Nabble.com.

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[R-sig-Geo] Re. Topographical Data SOS

2013-03-05 Thread CIO Student


Begin forwarded message:

 From: Christine Lynn Mc Lauchlan cmclauch...@upei.ca
 Date: March 5, 2013 7:34:15 PM GMT+01:00
 To: CIO Student swagathnavi...@gmail.com
 Subject: Re: Re. Topographical Data SOS
 
 Hi Swagath,
 
 THIS IS PERFECT! Oh my, I have been stuggling with this for ages, and all I 
 was missing it the simple geom_tile( ).
 
 Thank you so kindly,
 
 Christine
 
 
 
 
 
 
 
 
 On Tue, Mar 5, 2013 at 2:19 PM, CIO Student swagathnavi...@gmail.com wrote:
 
 Hi there,
 
 There are many ways to make a topographical map in R.  Given below are two 
 examples from R  to create a topographical map of a volcano.
 
 require(grDevices); require(graphics)
 filled.contour(volcano, color.palette = terrain.colors, asp = 1)
 title(main = volcano data: filled contour map)
 
 library (ggplot2)
 library(reshape2
 ggplot(melt(volcano), aes(x=Var1, y=Var2, fill=value))+geom_tile()
 
 
 I dont know if this is what you want to know?
 
 Cheers,
 Swagath Navin
 
 


[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[R-sig-Geo] question about image function

2013-03-05 Thread Hodgess, Erin
Hello again!

I'm running into a problem with the image function within a loop.  When I put 
it to the screen, it works fine, but when I put it to a PNG file, the picture 
doesn't change.

Here is the code:

for(i in 1:11) {
j1 - (i-1)*n2 + 1
j2 - i*n2

 predx - 
data.frame(pred=kr3$var1.pred[j1:j2],lon=kr3@sp@coords[,1],lat=kr3@sp@coords[,2])

 coordinates(predx) - ~lon+lat
 proj4string(predx) - proj4string(kr3)
 predx.wgs84 - spTransform(predx,CRS(+proj=longlat +datum=WGS84))
 llSPix - as(llSGDF, SpatialPixelsDataFrame)
 (st - system.time(llSPix$pred - idw(pred ~ 1,
 loc=predx.wgs84,newdata = llSPix, nmax = 16)$var1.pred))
 cat(stuff,i,\n)
f1 - paste(pred,i,a.png,sep=)
#Works fine
image(llSPix,pred,col=bpy.colors(),main=f1)


 assign(file1,f1)
 cat(filen,file1,\n)
 png(filename = file1, width = GRD.wgs84$width,
 height = GRD.wgs84$height,bg=transparent)
 par(mar = c(0, 0, 0, 0), xaxs = i, yaxs = i)
 image(llSPix, pred, col = bpy.colors())
 dev.off()
 kmlsetup(obj = GRD.wgs84, kmlfile =filename,
 imagefile = file1, name =as.character(2000+i))

}

Has anyone run into this before, please?

Thanks,
Erin


[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] question about image function

2013-03-05 Thread Michael Sumner
I don't see filename defined, or any packages required. Is it the png files
that are a problem or the 'kmlsetup' output? (whatever that is)

See the animation package for extremely simplifed image frame creation btw

On Wednesday, March 6, 2013, Hodgess, Erin wrote:

 Hello again!

 I'm running into a problem with the image function within a loop.  When I
 put it to the screen, it works fine, but when I put it to a PNG file, the
 picture doesn't change.

 Here is the code:

 for(i in 1:11) {
 j1 - (i-1)*n2 + 1
 j2 - i*n2

  predx - data.frame(pred=kr3$var1.pred[j1:j2],lon=kr3@sp
 @coords[,1],lat=kr3@sp@coords[,2])

  coordinates(predx) - ~lon+lat
  proj4string(predx) - proj4string(kr3)
  predx.wgs84 - spTransform(predx,CRS(+proj=longlat +datum=WGS84))
  llSPix - as(llSGDF, SpatialPixelsDataFrame)
  (st - system.time(llSPix$pred - idw(pred ~ 1,
  loc=predx.wgs84,newdata = llSPix, nmax = 16)$var1.pred))
  cat(stuff,i,\n)
 f1 - paste(pred,i,a.png,sep=)
 #Works fine
 image(llSPix,pred,col=bpy.colors(),main=f1)


  assign(file1,f1)
  cat(filen,file1,\n)
  png(filename = file1, width = GRD.wgs84$width,
  height = GRD.wgs84$height,bg=transparent)
  par(mar = c(0, 0, 0, 0), xaxs = i, yaxs = i)
  image(llSPix, pred, col = bpy.colors())
  dev.off()
  kmlsetup(obj = GRD.wgs84, kmlfile =filename,
  imagefile = file1, name =as.character(2000+i))

 }

 Has anyone run into this before, please?

 Thanks,
 Erin


 [[alternative HTML version deleted]]

 ___
 R-sig-Geo mailing list
 R-sig-Geo@r-project.org javascript:;
 https://stat.ethz.ch/mailman/listinfo/r-sig-geo



-- 
Michael Sumner
Hobart, Australia
e-mail: mdsum...@gmail.com

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] question about image function

2013-03-05 Thread Clint Bowman
When using png in a loop, especially one where the loop index is an 
integer, I usually make use of the %02d in the file name, e.g., 
png(pred_%02d_a.png,...)


Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 6 Mar 2013, Michael Sumner wrote:


I don't see filename defined, or any packages required. Is it the png files
that are a problem or the 'kmlsetup' output? (whatever that is)

See the animation package for extremely simplifed image frame creation btw

On Wednesday, March 6, 2013, Hodgess, Erin wrote:


Hello again!

I'm running into a problem with the image function within a loop.  When I
put it to the screen, it works fine, but when I put it to a PNG file, the
picture doesn't change.

Here is the code:

for(i in 1:11) {
j1 - (i-1)*n2 + 1
j2 - i*n2

 predx - data.frame(pred=kr3$var1.pred[j1:j2],lon=kr3@sp
@coords[,1],lat=kr3@sp@coords[,2])

 coordinates(predx) - ~lon+lat
 proj4string(predx) - proj4string(kr3)
 predx.wgs84 - spTransform(predx,CRS(+proj=longlat +datum=WGS84))
 llSPix - as(llSGDF, SpatialPixelsDataFrame)
 (st - system.time(llSPix$pred - idw(pred ~ 1,
 loc=predx.wgs84,newdata = llSPix, nmax = 16)$var1.pred))
 cat(stuff,i,\n)
f1 - paste(pred,i,a.png,sep=)
#Works fine
image(llSPix,pred,col=bpy.colors(),main=f1)


 assign(file1,f1)
 cat(filen,file1,\n)
 png(filename = file1, width = GRD.wgs84$width,
 height = GRD.wgs84$height,bg=transparent)
 par(mar = c(0, 0, 0, 0), xaxs = i, yaxs = i)
 image(llSPix, pred, col = bpy.colors())
 dev.off()
 kmlsetup(obj = GRD.wgs84, kmlfile =filename,
 imagefile = file1, name =as.character(2000+i))

}

Has anyone run into this before, please?

Thanks,
Erin


[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org javascript:;
https://stat.ethz.ch/mailman/listinfo/r-sig-geo




--
Michael Sumner
Hobart, Australia
e-mail: mdsum...@gmail.com

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] question about image function

2013-03-05 Thread Hodgess, Erin
It's the png file.  It seems to be writing the first data set over and over to 
the various png files.




From: Michael Sumner [mdsum...@gmail.com]
Sent: Tuesday, March 05, 2013 2:41 PM
To: Hodgess, Erin
Cc: r-sig-geo@r-project.org
Subject: Re: [R-sig-Geo] question about image function

I don't see filename defined, or any packages required. Is it the png files 
that are a problem or the 'kmlsetup' output? (whatever that is)

See the animation package for extremely simplifed image frame creation btw

On Wednesday, March 6, 2013, Hodgess, Erin wrote:
Hello again!

I'm running into a problem with the image function within a loop.  When I put 
it to the screen, it works fine, but when I put it to a PNG file, the picture 
doesn't change.

Here is the code:

for(i in 1:11) {
j1 - (i-1)*n2 + 1
j2 - i*n2

 predx - 
data.frame(pred=kr3$var1.pred[j1:j2],lon=kr3@sp@coords[,1],lat=kr3@sp@coords[,2])

 coordinates(predx) - ~lon+lat
 proj4string(predx) - proj4string(kr3)
 predx.wgs84 - spTransform(predx,CRS(+proj=longlat +datum=WGS84))
 llSPix - as(llSGDF, SpatialPixelsDataFrame)
 (st - system.time(llSPix$pred - idw(pred ~ 1,
 loc=predx.wgs84,newdata = llSPix, nmax = 16)$var1.pred))
 cat(stuff,i,\n)
f1 - paste(pred,i,a.png,sep=)
#Works fine
image(llSPix,pred,col=bpy.colors(),main=f1)


 assign(file1,f1)
 cat(filen,file1,\n)
 png(filename = file1, width = GRD.wgs84$width,
 height = GRD.wgs84$height,bg=transparent)
 par(mar = c(0, 0, 0, 0), xaxs = i, yaxs = i)
 image(llSPix, pred, col = bpy.colors())
 dev.off()
 kmlsetup(obj = GRD.wgs84, kmlfile =filename,
 imagefile = file1, name =as.character(2000+i))

}

Has anyone run into this before, please?

Thanks,
Erin


[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.orgUrlBlockedError.aspx
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


--
Michael Sumner
Hobart, Australia
e-mail: mdsum...@gmail.commailto:mdsum...@gmail.com

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] question about image function

2013-03-05 Thread Hodgess, Erin
That was it...thanks so much!


From: Clint Bowman [cl...@ecy.wa.gov]
Sent: Tuesday, March 05, 2013 2:46 PM
To: Michael Sumner
Cc: Hodgess, Erin; r-sig-geo@r-project.org
Subject: Re: [R-sig-Geo] question about image function

When using png in a loop, especially one where the loop index is an
integer, I usually make use of the %02d in the file name, e.g.,
png(pred_%02d_a.png,...)

Clint BowmanINTERNET:   cl...@ecy.wa.gov
Air Quality Modeler INTERNET:   cl...@math.utah.edu
Department of Ecology   VOICE:  (360) 407-6815
PO Box 47600FAX:(360) 407-7534
Olympia, WA 98504-7600

 USPS:   PO Box 47600, Olympia, WA 98504-7600
 Parcels:300 Desmond Drive, Lacey, WA 98503-1274

On Wed, 6 Mar 2013, Michael Sumner wrote:

 I don't see filename defined, or any packages required. Is it the png files
 that are a problem or the 'kmlsetup' output? (whatever that is)

 See the animation package for extremely simplifed image frame creation btw

 On Wednesday, March 6, 2013, Hodgess, Erin wrote:

 Hello again!

 I'm running into a problem with the image function within a loop.  When I
 put it to the screen, it works fine, but when I put it to a PNG file, the
 picture doesn't change.

 Here is the code:

 for(i in 1:11) {
 j1 - (i-1)*n2 + 1
 j2 - i*n2

  predx - data.frame(pred=kr3$var1.pred[j1:j2],lon=kr3@sp
 @coords[,1],lat=kr3@sp@coords[,2])

  coordinates(predx) - ~lon+lat
  proj4string(predx) - proj4string(kr3)
  predx.wgs84 - spTransform(predx,CRS(+proj=longlat +datum=WGS84))
  llSPix - as(llSGDF, SpatialPixelsDataFrame)
  (st - system.time(llSPix$pred - idw(pred ~ 1,
  loc=predx.wgs84,newdata = llSPix, nmax = 16)$var1.pred))
  cat(stuff,i,\n)
 f1 - paste(pred,i,a.png,sep=)
 #Works fine
 image(llSPix,pred,col=bpy.colors(),main=f1)


  assign(file1,f1)
  cat(filen,file1,\n)
  png(filename = file1, width = GRD.wgs84$width,
  height = GRD.wgs84$height,bg=transparent)
  par(mar = c(0, 0, 0, 0), xaxs = i, yaxs = i)
  image(llSPix, pred, col = bpy.colors())
  dev.off()
  kmlsetup(obj = GRD.wgs84, kmlfile =filename,
  imagefile = file1, name =as.character(2000+i))

 }

 Has anyone run into this before, please?

 Thanks,
 Erin


 [[alternative HTML version deleted]]

 ___
 R-sig-Geo mailing list
 R-sig-Geo@r-project.org javascript:;
 https://stat.ethz.ch/mailman/listinfo/r-sig-geo



 --
 Michael Sumner
 Hobart, Australia
 e-mail: mdsum...@gmail.com

   [[alternative HTML version deleted]]

 ___
 R-sig-Geo mailing list
 R-sig-Geo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-geo


___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[R-sig-Geo] writeOGR(GeoJSON) to string instead of file

2013-03-05 Thread Philip Greenwood
Hi all,

This is a re-post from a few weeks ago.

I'm using writeOGR{rgdal} to a create GeoJSON temporary file then reading the 
file and passing as a string in Java. It would be really nice to avoid writing 
the temporary file, and have writeOGR return a GeoJSON string.

Is this possible?

My project requires passing spatial data from R to Java, and then storing data 
as GeoJSON. I'm using RServe to interface between R and Java. 

Thanks.

Philip Greenwood

Geospatial and Analytics eEnabler 
Australian Urban Research Infrastructure Network (AURIN)
308 Doug McDonell Building, University of Melbourne
Tel: +61-(0)3-9035-8549
philip.greenw...@unimelb.edu.au

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[R-sig-Geo] ground overlays in KML

2013-03-05 Thread Hodgess, Erin
Hello again.

I'm not sure if I should ask this here, but I thought it might be a place to 
start:

I'm producing PNG files for ground overlays in Google Earth.  After some help 
from you this afternoon, my png files are ready.  However, the files do not run 
in sequence in Google Earth.  It shows the last file only.

Here is a little bit of the code:

kml xmlns:xsd=http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd; 
xmlns:xmlns=http://www.opengis.net/kml/2.2/; version=1.0
Document
Folder
GroundOverlay
name2001/name
TimeSpanbegin 2001-01-01 /begin
end 2001-12-31 /end/TimeSpan
Iconhrefpreda_01.png/hrefviewBoundScale0.75/viewBoundScale/Icon
LatLonBoxnorth36.48445398908/northsouth25.9875545196567/southeast-93.5186130430667/eastwest-106.704257739431/west/LatLonBox
/GroundOverlayGroundOverlay
name2002/name
TimeSpanbegin 2002-01-01 /begin
end 2002-12-31 /end/TimeSpan
Iconhrefpredb_01.png/hrefviewBoundScale0.75/viewBoundScale/Icon
LatLonBoxnorth36.48445398908/northsouth25.9875545196567/southeast-93.5186130430667/eastwest-106.704257739431/west/LatLonBox
/GroundOverlayGroundOverlay
name2003/name
TimeSpanbegin 2003-01-01 /begin
end 2003-12-31 /end/TimeSpan
Iconhrefpredc_01.png/hrefviewBoundScale0.75/viewBoundScale/Icon
LatLonBoxnorth36.48445398908/northsouth25.9875545196567/southeast-93.5186130430667/eastwest-106.704257739431/west/LatLonBox
/GroundOverlay
/Folder
/Document
kml



I'm also attaching the png files.

Thanks for any help.


attachment: preda_01.pngattachment: predb_01.pngattachment: predc_01.png___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] ground overlays in KML

2013-03-05 Thread Chris English

I imagine the final image is the last written.  

https://developers.google.com/kml/documentation/time 
explores various methods and additional tags employed for rendering sequences
and controlling overlays.
Hope it is in the right direction.

Chris

From: hodge...@uhd.edu
To: r-sig-geo@r-project.org
Date: Wed, 6 Mar 2013 02:07:11 +
Subject: [R-sig-Geo] ground overlays in KML

Hello again.

I'm not sure if I should ask this here, but I thought it might be a place to 
start:

I'm producing PNG files for ground overlays in Google Earth.  After some help 
from you this afternoon, my png files are ready.  However, the files do not run 
in sequence in Google Earth.  It shows the last file only.

Here is a little bit of the code:

kml xmlns:xsd=http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd; 
xmlns:xmlns=http://www.opengis.net/kml/2.2/; version=1.0
Document
Folder
GroundOverlay
name2001/name
TimeSpanbegin 2001-01-01 /begin
end 2001-12-31 /end/TimeSpan
Iconhrefpreda_01.png/hrefviewBoundScale0.75/viewBoundScale/Icon
LatLonBoxnorth36.48445398908/northsouth25.9875545196567/southeast-93.5186130430667/eastwest-106.704257739431/west/LatLonBox
/GroundOverlayGroundOverlay
name2002/name
TimeSpanbegin 2002-01-01 /begin
end 2002-12-31 /end/TimeSpan
Iconhrefpredb_01.png/hrefviewBoundScale0.75/viewBoundScale/Icon
LatLonBoxnorth36.48445398908/northsouth25.9875545196567/southeast-93.5186130430667/eastwest-106.704257739431/west/LatLonBox
/GroundOverlayGroundOverlay
name2003/name
TimeSpanbegin 2003-01-01 /begin
end 2003-12-31 /end/TimeSpan
Iconhrefpredc_01.png/hrefviewBoundScale0.75/viewBoundScale/Icon
LatLonBoxnorth36.48445398908/northsouth25.9875545196567/southeast-93.5186130430667/eastwest-106.704257739431/west/LatLonBox
/GroundOverlay
/Folder
/Document
kml



I'm also attaching the png files.  

Thanks for any help.



___ R-sig-Geo mailing list 
R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo 
   
___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] ground overlays in KML

2013-03-05 Thread Hodgess, Erin
I had seen this today too...it doesn't seem to work either?

Thanks though.
Erin


From: Chris English [sgl...@hotmail.com]
Sent: Tuesday, March 05, 2013 9:11 PM
To: Hodgess, Erin; Help R-Sig_Geo
Subject: RE: [R-sig-Geo] ground overlays in KML

I imagine the final image is the last written.

https://developers.google.com/kml/documentation/time
explores various methods and additional tags employed for rendering sequences
and controlling overlays.
Hope it is in the right direction.

Chris

From: hodge...@uhd.edu
To: r-sig-geo@r-project.org
Date: Wed, 6 Mar 2013 02:07:11 +
Subject: [R-sig-Geo] ground overlays in KML

Hello again.

I'm not sure if I should ask this here, but I thought it might be a place to 
start:

I'm producing PNG files for ground overlays in Google Earth.  After some help 
from you this afternoon, my png files are ready.  However, the files do not run 
in sequence in Google Earth.  It shows the last file only.

Here is a little bit of the code:

kml xmlns:xsd=http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd; 
xmlns:xmlns=http://www.opengis.net/kml/2.2/; version=1.0
Document
Folder
GroundOverlay
name2001/name
TimeSpanbegin 2001-01-01 /begin
end 2001-12-31 /end/TimeSpan
Iconhrefpreda_01.png/hrefviewBoundScale0.75/viewBoundScale/Icon
LatLonBoxnorth36.48445398908/northsouth25.9875545196567/southeast-93.5186130430667/eastwest-106.704257739431/west/LatLonBox
/GroundOverlayGroundOverlay
name2002/name
TimeSpanbegin 2002-01-01 /begin
end 2002-12-31 /end/TimeSpan
Iconhrefpredb_01.png/hrefviewBoundScale0.75/viewBoundScale/Icon
LatLonBoxnorth36.48445398908/northsouth25.9875545196567/southeast-93.5186130430667/eastwest-106.704257739431/west/LatLonBox
/GroundOverlayGroundOverlay
name2003/name
TimeSpanbegin 2003-01-01 /begin
end 2003-12-31 /end/TimeSpan
Iconhrefpredc_01.png/hrefviewBoundScale0.75/viewBoundScale/Icon
LatLonBoxnorth36.48445398908/northsouth25.9875545196567/southeast-93.5186130430667/eastwest-106.704257739431/west/LatLonBox
/GroundOverlay
/Folder
/Document
kml



I'm also attaching the png files.

Thanks for any help.



___ R-sig-Geo mailing list 
R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo