peterstace / simplefeatures

Simple Features is a pure Go Implementation of the OpenGIS Simple Feature Access Specification
MIT License
134 stars 19 forks source link

Retain coordinate type for empty simplified geometries #619

Closed peterstace closed 6 months ago

peterstace commented 6 months ago

Description

This fixes a bug where, in some scenarios, the Simplify operation would drop extended coordinate type information (from XYZ, XYM, or XYZM back to XY).

The bug happened because some geometry constructors inferred the geometry type from the input's lowest common denominator coordinate type. But if the input is empty, then the coordinate type is inferred as XY. The constructor design is a bit of a sharp edge and is not addressed here (instead, the bug that the sharp edge made more likely is fixed).

Check List

Have you:

Related Issue

peterstace commented 6 months ago

Thanks @albertteoh ! 😁