Add GEOSGeom_homogenize - #1493
Open
dbaston wants to merge 2 commits into
Open
Conversation
nyalldawson
reviewed
Jul 29, 2026
| * input is a single-element GeometryCollection, then the input will be | ||
| * destroyed and the single element returned. If the elements are not | ||
| * homogeneous, or if the input is not a collection, it will be returned | ||
| * unmodified. Nested collections are collapsed during processing. |
There was a problem hiding this comment.
Given that the current logic is all collection specific, should the function be named accordingly? ie "GEOSGeom_homogenizeCollection"?
There's an argument to be made that generic homogenization should also do things like turn a multilinestring containing a single linestring to a linestring, or turning a curve polygon which only consists of linestring rings into a non-curved polygon, or a compound curve with only straight segments to a linestring, etc...
Member
Author
There was a problem hiding this comment.
Maybe the function should be GEOSGeom_simplifyStructure, and it should handle the curve->line cases you're describing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
GEOSGeom_homogenizefunction to flatten a geometry (remove nesting) and convert it to its most specific representation. The existingGeometryFlattenerclass provides this, but it was not exposed to the C API. I don't feel like "homogenize" is a great description of what this does, but it has the advantage of matching the PostGISST_CollectionHomogenizewhose semantics it shares. Alternatives:GEOSGeom_refine,GEOSGeom_flattenPossibly useful as a postprocessing step for
GEOSSplit; see #1482