9

I have a dataset consisting of latitude-longitude pairs associated with some Z value (e.g. data regarding degree of plant vegetation coverage).

I'd like to perform some analyses on the spatial distribution of this data.

To do so, it will be necessary to bin proximal data points.

I would like to do this with a Discrete Global Grid such as an Icosahedron Snyder Equal Area (ISEA) grid, or the grid produced by DGGRID.

The key is that the latitude-longitude values of the data can be convertable into unique cell ids, that the latitude-longitude of the cell's center be determinable, the size of the cells be variable (for analysis at different spatial scales), and that the cells be of equal area to a close approximation.

An image depicting how this might look:

Discrete Global Grid

Is there anything in R which does this?

4 Answers 4

5

I've just completed an R package called dggridR which wraps dggrid in an easy-to-use way.

The package is also available on CRAN.

dggridR: Discrete Global Grids for R

2
  • Great! I'm going to check this out right away! Finally a cross-platform way of creating DGGs. Jul 13, 2016 at 2:08
  • Let me know how it goes for you: feedback is definitely appreciated.
    – Richard
    Jul 13, 2016 at 2:23
4

After searching high and low for exactly the same issue, I have ended up using DGGRID itself and R. DGGRID is excellent by the way. All the hard work has been done. It would be a major boon to the R community to have it implemented as a package (I hope Kevin Sahr is reading this).

Incidentally, that URL is out of date. I made the same mistake and ended up with an older version of DGGRID. The newest one, which is two versions further along, is at:

http://discreteglobalgrids.org/

6
  • I asked Sahr about this and he didn't seem to have plans, but said he'd appreciate it being done. I tried to write a thin wrapper myself, but it didn't transfer nicely between computers. I am going the Open GIS SWG on DGGs comes back with results soon.
    – Richard
    Aug 3, 2015 at 16:13
  • I'm amazed this need isn't more widespread. There isn't an easy cross-platform pre-compiled tool to do what DGGRID does. Compiling it took a lot of trial and error, but once it was done, it worked flawlessly. Aug 3, 2015 at 16:22
  • 1
    I've just finished an R package called dggridR which wraps DGGRID and works on Linux, Mac, and Windows. It's available on Github now, but should soon be available on CAN. The packages handles compiling DGGRID, so it should be quite easy to use.
    – Richard
    Jul 12, 2016 at 22:22
  • Running into a few little niggles with updating rgdal and sp from source. Does it really need the ultra new versions? Jul 15, 2016 at 15:24
  • I think it probably does not require the ultra new versions. I just used what I knew worked from my own setup. If you'd like to test it with the older versions you have installed and let me know if it works, I'd appreciate it!
    – Richard
    Jul 15, 2016 at 16:44
1

Why not use DGGRID itself, which can do everything you asked? For example, you could use DGGRID to transform a text file of lat/lon/datavalue records into records of the form cellID/datavalue, and then import those into R.

2
  • 2
    Because a great deal of data will be analyzed and the long/lat pairs are only two columns in otherwise large data frames. The possibility of mistakes in the export/import process is very real. It is best to contain as much of the analysis within R as possible.
    – Richard
    Aug 7, 2012 at 19:08
  • 1
    I've just finished an R package called dggridR which wraps DGGRID and works on Linux, Mac, and Windows. It's available on Github now, but should soon be available on CAN. The packages handles compiling DGGRID, so it should be quite easy to use.
    – Richard
    Jul 12, 2016 at 22:23
1

There is only one other lead I ever turned up for hexagonal gridding over a curved surface: some untested/beta functions for the hexbin package:

http://ugrad.stat.ubc.ca/R/library/hexbin/html/00Index.html

2
  • (PS: As a matter of protocol, let me know if this should have been part of the original answer, or whether it constitutes a new one!) Aug 18, 2015 at 15:33
  • Pretty sure this works fine as a separate answer, though they could also be combined. I think that's more a matter of style.
    – Richard
    Aug 18, 2015 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.