Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate from dggridr to h3 hexagons #31

Open
7yl4r opened this issue Jun 2, 2022 · 15 comments
Open

migrate from dggridr to h3 hexagons #31

7yl4r opened this issue Jun 2, 2022 · 15 comments

Comments

@7yl4r
Copy link
Member

7yl4r commented Jun 2, 2022

Several of us have had issues getting dggridr to work properly. The DESCRIPTION file currently has this set up to build it from C source code. We could try taking a different approach.

From Pieter:

I also had some issues with dggridr on a new machine, and I ended up using st_make_grid() with an equal area projection (EPSG:3410)

We could also try using the H3 grid.

@7yl4r 7yl4r changed the title make dggridr easier to use make dggridr issues go away Jun 2, 2022
@7yl4r
Copy link
Member Author

7yl4r commented Jun 6, 2022

Revisiting this. Here are ways forward I see:

  1. work with the dggridr maintainer to make the CRAN version work for us
  2. replace dggridr usage here with
    1. h3 grid
    2. st_make_grid

2.2 is probably easiest. 1 would be a good service for the community in general. 2.1 is the most forward-looking.

@7yl4r
Copy link
Member Author

7yl4r commented Jun 27, 2022

I have been working with a tool to display h3 grid data. It is a simple html+js+mapboxgl project that allows uploading of a .json file that contains pre-computed values for h3 hex grid indexes.

If we can compute the indicies for each h3 grid then we can export a .json file compatible with this tool.

@7yl4r
Copy link
Member Author

7yl4r commented Jun 30, 2022

The H3 viewer code is ready. @bbest : is converting the current code to calculate over h3 indices instead of dggriddr hexes easy?

@bbest
Copy link
Contributor

bbest commented Jul 1, 2022

Hey @7yl4r,

Your grid viewer looks pretty cool! The issue I was having with the H3 was with hexagons that cross the dateline (ie with vertices a little greater than 0 and a little less than 180 longitude).

It's interesting how your viewer seems to alternate between the two:

  • zoomed out: only dateline hexagons
    Screen Shot 2022-07-01 at 4 20 27 PM

  • zoomed in outside dateline: non-dateline hexagons
    Screen Shot 2022-07-01 at 4 20 42 PM

I made a little fix here for the H3 polygons with this little function fix_dateline(), but that's a different approach from using the existing H3 hexagons via JavaScript.

For another approach building the hexagons, something like:

@7yl4r
Copy link
Member Author

7yl4r commented Jul 1, 2022

Yeah, there is some javascript in the app that does something related to the dateline issue but obviously it isn't perfect.

For obisindicators we don't need to display the hexagons though, I just want to calculate es50 for each h3 hex.

@7yl4r
Copy link
Member Author

7yl4r commented Jul 6, 2022

Working to use H3 on the H3 branch.

@bbest bbest changed the title make dggridr issues go away migrate from dggridr to h3 hexagons Aug 2, 2022
@bbest
Copy link
Contributor

bbest commented Aug 2, 2022

Next step: split anti-meridonal hexagons into two with same h3 ID and still simple POLYGON not MULTIPOLYGON, as is done by sf::st_wrap_dateline().

See also:

@MathewBiddle
Copy link
Contributor

Please please please remove the dependency on dggridr. The installation process is a nightmare with that package.

@7yl4r
Copy link
Member Author

7yl4r commented Sep 22, 2022

I feel like there is some projection setting that will handle this hexagon wrapping issue that we are having on the h3 branch. Some discussion on this issue seems relevant. I am going to try playing with some of these sf features tomorrow.

@7yl4r
Copy link
Member Author

7yl4r commented Sep 24, 2022

It works!!!

I don't want to close this quite yet though because the builds are failing to build from the DESCRIPTION.

  • local::.: Can't install dependency h3
  • h3: Can't find package called h3.

The remote is pointing to the correct repo though... so I don't know what the problem is.

Is installation and function of v0.1.0+ working on anyone's machine?

@7yl4r
Copy link
Member Author

7yl4r commented Oct 5, 2022

I was able to do a fresh install without seeing the "can't install dependency h3" issue.

I did run into some other complications as documented in 819f845, but none related to the installation issue in the github action.

7yl4r added a commit that referenced this issue Oct 5, 2022
attempted fix for failing builds mentioned in #31
7yl4r added a commit that referenced this issue Oct 5, 2022
attempted fix for failing builds mentioned in #31
@MathewBiddle
Copy link
Contributor

I'll give this a try sometime soon 🤞

@bbest
Copy link
Contributor

bbest commented Oct 5, 2022

I wonder if the issue here has to do with the mismatch between the repo name h3-r and the package name h3:

Imports:
dplyr,
ggplot2,
gsl,
h3,
rnaturalearth,
rnaturalearthdata,
sf,
viridis
Remotes:
crazycapivara/h3-r
Config/testthat/edition: 3

@7yl4r
Copy link
Member Author

7yl4r commented Oct 6, 2022

I wonder if the issue here has to do with the mismatch between the repo name h3-r and the package name h3:

Imports:
dplyr,
ggplot2,
gsl,
h3,
rnaturalearth,
rnaturalearthdata,
sf,
viridis
Remotes:
crazycapivara/h3-r
Config/testthat/edition: 3

That's the best theory so far. We may need to report this to the github action.

I tried another syntax for the DESCRIPTION file and now there is a different error:

 Error: Error: <callr_remote_error: Cannot install packages:
  * deps::.: Can't install dependency github::crazycapivara/h3-r
  * pkgdown: dependencies must be TRUE, FALSE, NA or a list of dependency types>

@MathewBiddle
Copy link
Contributor

h3 grid calculations take forever. I wonder if h3o is a package to explore to speed up the process?

https://josiahparry.com/projects/pkgs/h3o.html

I don't think it would change a lot of the obisindicators package...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants