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

how to merge polygons after computing min? #1

Closed
tdhock opened this issue Feb 26, 2024 · 2 comments
Closed

how to merge polygons after computing min? #1

tdhock opened this issue Feb 26, 2024 · 2 comments

Comments

@tdhock
Copy link
Owner

tdhock commented Feb 26, 2024

looks like sf has intersects and relate, nice figure r-spatial/sf#234 (comment) and discussion below that.

@tdhock
Copy link
Owner Author

tdhock commented Feb 26, 2024

actually the motivation behind merging polygons was as an analog to the 1d parameter case in functional pruning, where you merge adjacent intervals with the same coefficients. but in the 2d case we are already storing a more complex object (polygon) so instead of merging adjacent polygons with the same coefficients, we could actually have one MULTIPOLYGON geometry (each polygon therein would have the same coefs) as shown in the figure below from https://r-spatial.github.io/sf/articles/sf1.html
unnamed-chunk-11-1
in that case the important operation to reduce computational complexity is simplifying polygons, maybe this can be done with sf::st_simplify? r-spatial/sf#381 has some discussion of alternatives. its man page says

preserveTopology: logical; carry out topology preserving
          simplification? May be specified for each, or for all feature
          geometries. Note that topology is preserved only for single
          feature geometries, not for sets of them. If not specified
          (i.e. the default), then it is internally set equal to
          'FALSE' when the input data is specified with projected
          coordinates or 'sf_use_s2()' returns 'FALSE'. Ignored in all
          the other cases (with a warning when set equal to 'FALSE')
          since the function implicitly calls 's2::s2_simplify' which
          always preserve topological relationships (per single
          feature).

dTolerance: numeric; tolerance parameter, specified for all or for each
          feature geometry. If you run 'st_simplify', the input data is
          specified with long-lat coordinates and 'sf_use_s2()' returns
          'TRUE', then the value of 'dTolerance' must be specified in
          meters.

@tdhock
Copy link
Owner Author

tdhock commented Mar 1, 2024

@tdhock tdhock closed this as completed Mar 1, 2024
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

1 participant