[R-sig-Geo] measuring angle or relative direction of 2 lines

2011-10-17 Thread Tracey Osborne
measuring the angle between intersecting lines:  Does anyone know of any
helpful tools/methods in R for measuring the angle between two intersecting
lines in a map or an equation that would do so with the start and end
latitudes and longitudes of the two lines?  Or give directions of lines?

Cheers
Tracey

[[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] Creating big raster from small tiles

2011-10-17 Thread steven mosher
 Thanks,

I basically have to reclass()  all 72 tiles, then aggregate() them
from 30 arc seconds to 5 minutes  and eventually put them in a brick
with other rasters
so I can average across the layers.

I thought unionExtent() was going to be the ticket, but that just
effects the extent.
unionRaster() is really what would be cool for working with tiles.
I'll take a look
at the gdal stuff

Steve



On Sun, Oct 16, 2011 at 10:01 PM, Robert J. Hijmans r.hijm...@gmail.com wrote:
 Steven,
 In principle you could give merge all tiles (e.g. make a list of RasterLayer
 objects and use do.call ) but merge is quite slow (something that can easily
 be be improved; and I expect it will be over the coming months).
 What I would do is use run gdalbuildvrt (that comes with the FWtools). This
 creates a single header file that lets you access all the tiles as a single
 virtual file. If you want a single file for better performance, you can use
 writeRaster to save it to e.g. a single geotiff file.

 Robert

 On Sun, Oct 16, 2011 at 8:54 PM, steven mosher mosherste...@gmail.com
 wrote:

  I have 72 tiles in a tif format and each tile is   30X30

 tile
 class       : RasterLayer
 dimensions  : 3600, 3600, 1296  (nrow, ncol, ncell)
 resolution  : 0.00833, 0.00833  (x, y)
 extent      : 60, 90, 60, 90  (xmin, xmax, ymin, ymax)
 coord. ref. : NA
 values      : C:/Users/steve/
 min value   : 0
 max value   : 255

 What I'd like to do is find  the fastest way to bring all 72 tiles
 into one big raster.

 merge() seems like one good choice, where I would   merge each tile
 with a blank raster that would get
 filled in incrementally by each tile

  world
 class       : RasterLayer
 dimensions  : 21600, 43200, 93312  (nrow, ncol, ncell)
 resolution  : 0.00833, 0.00833  (x, y)
 extent      : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
 coord. ref. : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
 +towgs84=0,0,0
 values      : none

 world - merge(tile, world)

 and the  repeat that for the remaining 71 tiles.  I'm also think that
 one could extract the values from the tile
 and use setValues  but  that appears to hit the memory wall in
 Windows.  The other option
 I suppose is to use writeValues()  and create  a big file from the tiles.

 Am I missing any obvious options?

 Steve

 ___
 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] errors in installing HDF5 package under windows

2011-10-17 Thread Paul Hiemstra
On 10/16/2011 02:10 PM, zhijie zhang wrote:
 cygwin warning:
   MS-DOS style path detected:
 C:/PROGRA~1/R/R-213~1.2/bin/i386/HDF5~1.RCH/hdf5/libs
   Preferred POSIX equivalent is:
 /cygdrive/c/PROGRA~1/R/R-213~1.2/bin/i386/HDF5~1.RCH/hdf5/libs
   CYGWIN environment variable option nodosfilewarning turns off this
 warning.

Have you tried this suggestion?

Paul

-- 
Paul Hiemstra, Ph.D.
Global Climate Division
Royal Netherlands Meteorological Institute (KNMI)
Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
P.O. Box 201 | 3730 AE | De Bilt
tel: +31 30 2206 494

http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770

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


Re: [R-sig-Geo] Delete points within a certain distance of each other

2011-10-17 Thread Mathieu Rajerison
spatstat::nndist?

2011/10/17 Paul Hiemstra paul.hiems...@knmi.nl

 On 10/15/2011 02:57 PM, Sandeep Patil wrote:
  Hello all
 
  I have about 4500 spatial points which are irregularly spaced...
 
  What is want to do is to replace points that are clustered very near
 
  each other by one point ...i.e say the distance betweeen Point A  Point
 B
 
  is less than a threshold that i will define , i will delete either A or B
  and essentially
 
  do this for the complete dataset so that there is at least a minimum
  separation
 
  between every pair of points.
 
  Any idea how to proceed ?
 
  Sandeep
 
[[alternative HTML version deleted]]
 
  ___
  R-sig-Geo mailing list
  R-sig-Geo@r-project.org
  https://stat.ethz.ch/mailman/listinfo/r-sig-geo

 ?spDists, ?zerodist

 Paul

 --
 Paul Hiemstra, Ph.D.
 Global Climate Division
 Royal Netherlands Meteorological Institute (KNMI)
 Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39
 P.O. Box 201 | 3730 AE | De Bilt
 tel: +31 30 2206 494

 http://intamap.geo.uu.nl/~paul
 http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770

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


[[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] IDW example

2011-10-17 Thread Ashton Shortridge
On 10/16/11, Hodgess, Erin, wrote:
 Dear R Sig Geo People:
 
 Here is probably a dumb question, so please forgive me in advance (or
 swear, whatever is most appropriate):  could someone recommend a good
 reference on IDW that has a numeric example, please?

Sure, check out Paul Bolstad's GIS Fundamentals textbook. My third edition has 
a very small worked example on pages 447-448.

It is straightforward to implement a small worked IDW example in a 
spreadsheet. You can mess around with the form of the weight, the distance to 
the point to be interpolated, and so on. Of course, it is not too hard to do 
this in R, either! gstat can do it, and you can roll your own code, e.g.:

# idw
# A function to perform IDW Interpolation to a matrix
# z is a vector of heights, distance is an mxn distance matrix
# indicating distances between the m grid points and n scattered
# sampled points, k is the power (typically 2), and num.neighs is 
# the closest x points to use in the interpolation.
idw - function(z, distance, k, num.neighs) {
   idw.z - rep(0, length(distance[,1]))
   for (i in 1:length(distance[,1])) {
  d - sort(distance[i,], index.return=TRUE)  # sort to find closest points
  w - 1 / d$x[1:num.neighs]^k # The vector of the weights
  idw.z[i] - sum(z[d$ix[1:num.neighs]]*w) / sum(w)  # The value for grid 
cell i
   }
   idw.mat - matrix(idw.z, nrow=40, ncol=40)  # convert to matrix 
   return(idw.mat)
}


Hope this helps,

Ashton



On 10/16/11, Hodgess, Erin, wrote:
 Dear R Sig Geo People:
 
 Here is probably a dumb question, so please forgive me in advance (or
 swear, whatever is most appropriate):  could someone recommend a good
 reference on IDW that has a numeric example, please?
 
 I like to work things out on a small scale to see how they work.
 
 thanks,
 Erin
 
 
 Erin M. Hodgess, PhD
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: hodge...@uhd.edu
 
 
   [[alternative HTML version deleted]]
 
 ___
 R-sig-Geo mailing list
 R-sig-Geo@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-geo


-
Ashton Shortridge
Associate Professor ash...@msu.edu
Dept of Geography   http://www.msu.edu/~ashton
235 Geography Building  ph (517) 432-3561
Michigan State University   fx (517) 432-1671

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


Re: [R-sig-Geo] IDW example

2011-10-17 Thread Peter Larson
Believe it or not, the Wikipedia entry has the formula listed. You can
easily try it out yourself. It's such a simple procedure that it can
be done by hand.

http://en.wikipedia.org/wiki/Inverse_distance_weighting

Pete



On 10/16/11, Hodgess, Erin hodge...@uhd.edu wrote:
 Dear R Sig Geo People:

 Here is probably a dumb question, so please forgive me in advance (or swear,
 whatever is most appropriate):  could someone recommend a good reference on
 IDW that has a numeric example, please?

 I like to work things out on a small scale to see how they work.

 thanks,
 Erin


 Erin M. Hodgess, PhD
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: hodge...@uhd.edu


   [[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] IDW example

2011-10-17 Thread giuseppe calamita
Hi Erin,
did you check the book from Roger Bivand -Edzer Pebesma and Gomez-Rubìo: 
Applied spatial data analysis with R?
There is some short explanation of how the algorithm work and just one record 
of code.
If you want I think I can send you some line of codes as examples.


Giuseppe




Da: r-sig-geo-requ...@r-project.org r-sig-geo-requ...@r-project.org
A: r-sig-geo@r-project.org
Inviato: Lunedì 17 Ottobre 2011 12:00
Oggetto: R-sig-Geo Digest, Vol 98, Issue 15

- Messaggio inoltrato -

Send R-sig-Geo mailing list submissions to
    r-sig-geo@r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
    https://stat.ethz.ch/mailman/listinfo/r-sig-geo
or, via email, send a message with subject or body 'help' to
    r-sig-geo-requ...@r-project.org

You can reach the person managing the list at
    r-sig-geo-ow...@r-project.org

When replying, please edit your Subject line so it is more specific
than Re: Contents of R-sig-Geo digest...

Today's Topics:

   1. errors in installing HDF5 package under windows (zhijie zhang)
   2. IDW example (Hodgess, Erin)
   3. Creating big raster from small tiles (steven mosher)
   4. Re: Creating big raster from small tiles (steven mosher)
   5. Re: Creating big raster from small tiles (Robert J. Hijmans)
   6. Re: Getting the other GIS to recognize files created by
      writeRaster() (Robert J. Hijmans)
   7. measuring angle or relative direction of 2 lines (Tracey Osborne)
   8. Re: Creating big raster from small tiles (steven mosher)
   9. Re: errors in installing HDF5 package under windows
      (Paul Hiemstra)
  10. Re: Delete points within a certain distance of each    other
      (Paul Hiemstra)
  11. Re: Delete points within a certain distance of each    other
      (Mathieu Rajerison)
  12. Re: errors in installing HDF5 package under windows
      (Paul Hiemstra)
Dear all,
  The HDF5 binary package is not available now, so i download the source
package and unzip it. When i check it before building the package, some
errors appeared, see below. I donot think it's related with the R and HDF5
versions. I guess i missed something here.
--Errors--
* installing *source* package 'hdf5' ...
cygwin warning:
  MS-DOS style path detected:
C:/PROGRA~1/R/R-213~1.2/bin/i386/HDF5~1.RCH/hdf5/libs
  Preferred POSIX equivalent is:
/cygdrive/c/PROGRA~1/R/R-213~1.2/bin/i386/HDF5~1.RCH/hdf5/libs
  CYGWIN environment variable option nodosfilewarning turns off this
warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
cp: cannot stat `/cygdrive/d/Backup/my
documents/hdf5-support/cyghdf5-0.dll': No such file or directory
cp: cannot stat `/cygdrive/d/Backup/my documents/hdf5-support/mgwz.dll': No
such file or directory
ERROR: configuration failed for package 'hdf5'
* removing 'C:/PROGRA~1/R/R-213~1.2/bin/i386/HDF5~1.RCH/hdf5'
-
If anybody have some experiences on reading HDF4 and HDF5 datasets
successfully, please also give me more information on this.
  I have searched the R help, and cannot find a solution. Somebody suggest
the rgdal, which seems not to work.
  Any suggestions or help are greatly appreciated.

-- 
With Kind Regards,

oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:
[***]
ZhiJie Zhang,MD,PhD
Dept.of Epidemiology, School of Public Health,Fudan University
Office:Room 443, Building 8
Office Tel./Fax.:+86-21-54237410
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
Email:epis...@gmail.com
[***]
oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:

    [[alternative HTML version deleted]]


Dear R Sig Geo People:

Here is probably a dumb question, so please forgive me in advance (or swear, 
whatever is most appropriate):  could someone recommend a good reference on IDW 
that has a numeric example, please?

I like to work things out on a small scale to see how they work.

thanks,
Erin


Erin M. Hodgess, PhD
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: hodge...@uhd.edu


    [[alternative HTML version deleted]]


I have 72 tiles in a tif format and each tile is   30X30

tile
class       : RasterLayer
dimensions  : 3600, 3600, 1296  (nrow, ncol, ncell)
resolution  : 0.00833, 0.00833  (x, y)
extent      : 60, 90, 60, 90  (xmin, xmax, ymin, ymax)
coord. ref. : NA
values      : C:/Users/steve/
min value   : 0
max value   : 255

What I'd like to do is find  the fastest way to bring all 72 tiles
into one big raster.

merge() seems like one good choice, where I would   merge each tile
with a blank raster that would get
filled in incrementally by each tile

 world
class       : RasterLayer
dimensions  : 21600, 43200, 

Re: [R-sig-Geo] IDW example -- gstat, spatstat

2011-10-17 Thread Edzer Pebesma

You are right -- google pointed me to the example:

http://www.asdar-book.org/book/vis_mod.R

chunk 31, where the function krige, without variogram model, results 
in idw. To avoid confusing scripts that suggest kriging takes place, 
package gstat also provides a function idw, which does the same thing, by


zn.idw - idw(log(zinc) ~ 1, meuse, meuse.grid)

In addition, package spatstat contains a function called idw, doing idw 
interpolation on a marked point pattern. When loading both spatstat and 
gstat, this means the order of loading matters.


On 10/17/2011 03:39 PM, giuseppe calamita wrote:

Hi Erin,
did you check the book from Roger Bivand -Edzer Pebesma and Gomez-Rubìo: 
Applied spatial data analysis with R?
There is some short explanation of how the algorithm work and just one record 
of code.
If you want I think I can send you some line of codes as examples.


Giuseppe




Da: r-sig-geo-requ...@r-project.orgr-sig-geo-requ...@r-project.org
A: r-sig-geo@r-project.org
Inviato: Lunedì 17 Ottobre 2011 12:00
Oggetto: R-sig-Geo Digest, Vol 98, Issue 15

- Messaggio inoltrato -

Send R-sig-Geo mailing list submissions to
 r-sig-geo@r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
 https://stat.ethz.ch/mailman/listinfo/r-sig-geo
or, via email, send a message with subject or body 'help' to
 r-sig-geo-requ...@r-project.org

You can reach the person managing the list at
 r-sig-geo-ow...@r-project.org

When replying, please edit your Subject line so it is more specific
than Re: Contents of R-sig-Geo digest...

Today's Topics:

1. errors in installing HDF5 package under windows (zhijie zhang)
2. IDW example (Hodgess, Erin)
3. Creating big raster from small tiles (steven mosher)
4. Re: Creating big raster from small tiles (steven mosher)
5. Re: Creating big raster from small tiles (Robert J. Hijmans)
6. Re: Getting the other GIS to recognize files created by
   writeRaster() (Robert J. Hijmans)
7. measuring angle or relative direction of 2 lines (Tracey Osborne)
8. Re: Creating big raster from small tiles (steven mosher)
9. Re: errors in installing HDF5 package under windows
   (Paul Hiemstra)
   10. Re: Delete points within a certain distance of eachother
   (Paul Hiemstra)
   11. Re: Delete points within a certain distance of eachother
   (Mathieu Rajerison)
   12. Re: errors in installing HDF5 package under windows
   (Paul Hiemstra)
Dear all,
   The HDF5 binary package is not available now, so i download the source
package and unzip it. When i check it before building the package, some
errors appeared, see below. I donot think it's related with the R and HDF5
versions. I guess i missed something here.
--Errors--
* installing *source* package 'hdf5' ...
cygwin warning:
   MS-DOS style path detected:
C:/PROGRA~1/R/R-213~1.2/bin/i386/HDF5~1.RCH/hdf5/libs
   Preferred POSIX equivalent is:
/cygdrive/c/PROGRA~1/R/R-213~1.2/bin/i386/HDF5~1.RCH/hdf5/libs
   CYGWIN environment variable option nodosfilewarning turns off this
warning.
   Consult the user's guide for more details about POSIX paths:
 http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
cp: cannot stat `/cygdrive/d/Backup/my
documents/hdf5-support/cyghdf5-0.dll': No such file or directory
cp: cannot stat `/cygdrive/d/Backup/my documents/hdf5-support/mgwz.dll': No
such file or directory
ERROR: configuration failed for package 'hdf5'
* removing 'C:/PROGRA~1/R/R-213~1.2/bin/i386/HDF5~1.RCH/hdf5'
-
If anybody have some experiences on reading HDF4 and HDF5 datasets
successfully, please also give me more information on this.
   I have searched the R help, and cannot find a solution. Somebody suggest
the rgdal, which seems not to work.
   Any suggestions or help are greatly appreciated.




___
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] multitype point patterns

2011-10-17 Thread Marcelino de la Cruz


Hi  Aurelie,

Try  this:

skate.ppp$marks - data.frame(species=skate.ppp$marks, number=skate$number)


HTH,

MArcelino


At 17:41 17/10/2011, GodinA wrote:
Hi all, I have a multitype point patterns 
representing 12 different species as 
follow: marked planar point pattern: 821 
points multitype, with levels = 
8890  91  92  93  94  96 
  98  99  100 102 
107 window: rectangle = [-60, -45] x [40, 56] 
units  
head(as.data.frame(skate.ppp)) x  y 
marks 1 -54.198 55.12788 2 -51.071 
43.01588 3 -47.050 48.11188 4 -46.377 
47.55288 5 -46.470 47.27488 6 -51.301 
43.04188 I would like to add another mark 
with the number of species found at each 
location. I'm sure this is fairly 
straightforward, but somehow I am struggling 
with it! I have been doing the 
following: marks(skate.ppp) - skate$number 
However, when I do so, I am replacing all my 
previous marks by these new ones...  
head(as.data.frame(skate.ppp)) x  y 
marks 1 -54.198 55.127 2 2 -51.071 
43.015 1 3 -47.050 48.111 2 4 -46.377 
47.552 1 5 -46.470 47.274 1 6 -51.301 
43.041 4  skate.ppp marked planar point 
pattern: 821 points marks are numeric, of type 
‘double’ window: rectangle = [-60, -45] x 
[40, 56] units  Thank you very much in advance! 
Aurelie - Aurelie Cosandey-Godin Ph.D. 
Candidate, Department of Biology Industrial 
Graduate Fellow, WWF-Canada Dalhousie University 
| Biology Dept. |Halifax, NS, Canada Email: 
god...@dal.ca | Web: wormlab.biology.dal.ca 
-- 
Want to learn more about sharks in Atlantic 
Canada? Visit ShARCC! www.atlanticsharks.org -- 
View this message in context: 
http://r-sig-geo.2731867.n2.nabble.com/multitype-point-patterns-tp6901052p6901052.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



Marcelino de la Cruz Rot
Depto. Biologia Vegetal
EUIT Agricola
Universidad Politecnica de Madrid

tel: 34 + 913365435
  
[[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] multitype point patterns

2011-10-17 Thread GodinA
Awesome! Thank you very much MArcelino!

-
Aurelie Cosandey-Godin
Ph.D. Candidate, Department of Biology
Industrial Graduate Fellow, WWF-Canada

Dalhousie University | Biology Dept. |Halifax, NS, Canada 
Email: god...@dal.ca | Web: wormlab.biology.dal.ca
--
Want to learn more about sharks in Atlantic Canada? Visit ShARCC! 
www.atlanticsharks.org
--
View this message in context: 
http://r-sig-geo.2731867.n2.nabble.com/multitype-point-patterns-tp6901052p6901258.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