| 34 | |
| 35 | === GEOS !PrecisionModel === |
| 36 | The [http://geos.refractions.net/ro/doxygen_docs/html/classgeos_1_1geom_1_1PrecisionModel.html geos::geom::PrecisionModel GEOS PrecisionModel Class] was ported from JTS to the GEOS C++ API, but there is no C API for this feature. Adding a !PrecisionModel to the GEOS functionality uses a precision grid to "snap" all coordinates, which could eliminate some rounding and robustness issues with some functions. |
| 37 | |
| 38 | The functionality can be previewed graphically with JTS !TestBuilder, in the top menu Edit > Precision Model ... For example, if you want to have millimetre tolerance, set the fixed to "1000.0", now an input geometry of `'POINT (130.111 281.999)'` will remain the same, but an input of `'POINT (130.1111 281.9999)'` will auto magically snap to `'POINT (130.111 282)'`. Other functions, such as buffer, will also have results that conform to no more than millimetre precision (three decimal places). |
| 39 | |
| 40 | In order for this functionality to be used in PostGIS, it would first need to be exposed to the GEOS C API. Secondly, PostGIS would need to somehow communicate the precision model to be used, based on some metadata. As a first pass idea, the topology extension has a few metadata tables, where a tolerance could somehow be specified. I'm not sure how it could be implemented to other geometries without a server runtime variable (e.g., [http://www.postgresql.org/docs/current/static/runtime-config-custom.html Customized Options]). |