| 9 | = Requirements for Shapely = |
| 10 | |
| 11 | Shapely (https://github.com/Toblerity/Shapely) is one of the major Python users of GEOS. I want to let programmers select and use a precision model like this: |
| 12 | |
| 13 | {{{ |
| 14 | from shapely.geometry import Point |
| 15 | from shapely.precision import fixed_model |
| 16 | |
| 17 | # make a fixed-precision model. |
| 18 | fixed = fixed_model(scale=1.0, offset=(0.0, 0.0)) |
| 19 | |
| 20 | # make a point snapped to a fixed-precision grid. |
| 21 | p = Point(0, 0, model=fixed) |
| 22 | |
| 23 | # make a float-precision point. |
| 24 | q = Point(0, 0) |
| 25 | }}} |
| 26 | |
| 27 | The above is a bit of a reversal from what I've previously written about my precision model requirements. A Python API like the one above is going to be very reliable and doesn't leave any geometry objects twisting in the wind when their precision model goes away: they have references to the model which keep it "alive". So, my main requirement for the precision model in the C API is now: |
| 28 | |
| 29 | == No global state == |
| 30 | |
| 31 | There shouldn't be a precision model in the global context. Or if there is, it shouldn't preclude precision models outside the global context. |
| 32 | |