GIScience / GIScience/oshdb

Add geometry transformation operations

Open
#437 0 comments 0 reactions 1 assignee Claimed by @tyrasd View on GitHub
enhancement priority:low
Dominant language
Java
Stars
131
Forks
19
PR merge metrics
No merged PRs in 30d

Description

### Problem Description
Sometimes one desires that polygonal or line features are reduced to a single point before further operations such as counting-by-geometry are performed in order to avoid potentially unwanted side effects such as double counting of features which lie on the border of two `aggregateByGeometry` polygons. This could be avoided if there was a possibility to reduce the more complex geometry to a point before further internal operations are performed.

### Expected Solution
There should be a functionality to transform the geometry after it has been built, but before the clipping-to-the-area-of-interest or aggregation-by-geometry is applied. This could take an arbitrary `Function` as an argument which could transform the feature's geometry to anything[^1] one desires, e.g. applying `geometry.centroid()`.

### Alternative Solutions

* Alternatively, the complete geometry builder could be made customizable, but that seems at first to be much harder to use by the user for the typical use case of just simplifying geometries down to a centroid for example.
* A simple boolean switch `transformToCentroid` (or similar) would suffice for the most simple use case, but is less flexible (e.g. maybe one wants to convert polygons to their outline, or add/remove inner rings from polygons, etc.).

### Additional Context

[^1]: This transformation cannot be completely arbitrary, since some prefiltering which happens on the features' bounding boxes (or even cell id) would be unaffected by this. I think the transformation result needs to be inside the bounding box of the feature's original geometry bounding box. should be sufficient.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.