peterstace / simplefeatures

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

Remove error and ctor options from direct ctors #530

Closed peterstace closed 11 months ago

peterstace commented 11 months ago

Description

Modify direct constructors (NewPoint etc.) to no longer perform validation at all. The direct constructors are for more advanced use cases where geometries are being constructed from other geometries or raw sequences of floats. Things like custom geometric algorithms come to mind. Because these are for advanced use cases, making users validate manually is reasonable.

Modifying direct constructors removes error handling mismatch, with users no longer having to handle errors that can never occur (when validation is disabled). It also eliminates the situation where constructor options would sometimes be ignored, and simplifies the rules around what validation occurs during direct construction (i.e. now none is performed).

See https://github.com/peterstace/simplefeatures/discussions/525 for more context.

Check List

Have you:

Related Issue

Benchmark Results

Benchmark results are attached. Some notes about the apparent regressions:

results.txt

peterstace commented 11 months ago

Thanks for reviewing @albertteoh , I really appreciate it 😁