Re: [R-sig-Geo] IDW example
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
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
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
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