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

export hexagon spatialFeatures for ArcGIS? #43

Open
7yl4r opened this issue Dec 1, 2022 · 1 comment
Open

export hexagon spatialFeatures for ArcGIS? #43

7yl4r opened this issue Dec 1, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@7yl4r
Copy link
Member

7yl4r commented Dec 1, 2022

@bbest : maybe you will be able to help here...

can we export the H3 hexagon grid as a set of SpatialFeatures (.geojson?) that can be easily imported into ArcGIS?

This is the workflow requested by Mimi D'lorio of the America The Beautiful initiative.

@7yl4r 7yl4r added the enhancement New feature or request label Dec 1, 2022
@MathewBiddle
Copy link
Contributor

Yup, totally doable. I did it in MathewBiddle/globe#18

make_hex_res returns the geometry as a feature sf object. Simply use geojsonsf::sf_geojson() to return the geojson, and save that to a file. For example:

resolution <- 3

hex <- obisindicators::make_hex_res(resolution)
 
occ <- occ %>%
      mutate(
        cell = h3::geo_to_h3(
          data.frame(decimalLatitude,decimalLongitude),
          res = resolution
        )
      )
     
idx <- obisindicators::calc_indicators(occ)
    
grid <- hex %>%
      inner_join(
        idx,
        by = c("hexid" = "cell")
      )

geojson_string <- geojsonsf::sf_geojson(grid)

fname <- 'all_indicators.geojson'

write(x=geojson_string, file=fname)

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

No branches or pull requests

2 participants