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

contourize() and polygonize() #9

Open
noamross opened this issue Apr 8, 2017 · 1 comment
Open

contourize() and polygonize() #9

noamross opened this issue Apr 8, 2017 · 1 comment

Comments

@noamross
Copy link
Collaborator

noamross commented Apr 8, 2017

Functions to convert rasters/stars/matrices to sf.

  • Use marching squares as implemented in https://github.com/d3/d3-contour/blob/85cd144ce28a0bb5cb5c282604e8c24e23e7c772/src/contours.js
  • contourize(): produce LINESTRINGS with value equal to threshold
    • closed=TRUE: close contours at edges of extent. Otherwise end lines at extent.
  • polygonize(): produce closed polygons with values of upper and lower bounds
    • rings=TRUE produce polygons with holes. Otherwise filled polygons with values over threshold
    • Always produce MULTIPOLYGONS - can be simplified later if needed. Number of rows should be determined by number of bins/levels.
  • smooth=TRUE, use linear interpolation to smooth contours
  • Factor rasters should produce outline shapes/lines of each factor level, otherwise bin at threshold levels.
  • Export C++ functions
  • Allow input of plain matrix in addition to raster.
@mdsumner
Copy link
Collaborator

I'd forgotten about this, I've been exploring marching squares with vectorized R code and some raster tricks - I think it's feasible, though the C++ would obviously be faster. Just FYI if/when anyone gets to this

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

No branches or pull requests

2 participants