Closed utapyngo closed 2 years ago
Most users' geospatial stacks require at least one other library with a numpy dependency, or numpy itself. I'm happy to look at a PR that makes it optional, but I won't be implementing this myself.
I can imagine a separate library without this requirement, but is it possible to make numpy optional?
@urschrei I could try, but I am not good at Cython. These lines look too cryptic to me:
cdef double[:,::1] ncoords = np.array(arr, dtype=np.float64)
cdef double[:, ::1] view = <double[:result.len,:2:1]>incoming_ptr
Could you please give me a link to the docs explaining this?
Google gives this but two-dimensional arrays are not mentioned there.
That's typed memoryview syntax: https://cython.readthedocs.io/en/latest/src/userguide/memoryviews.html
The syntax is described here: https://cython.readthedocs.io/en/stable/src/userguide/memoryviews.html#specifying-more-general-memory-layouts
And the array syntax here: https://cython.readthedocs.io/en/stable/src/userguide/memoryviews.html#cython-arrays
e.g. The ::1
means that the memory is contiguous.
Thank you @urschrei I have created a draft PR #25, please take a look.
Released to PyPI: https://pypi.org/project/simplification/0.6.0/
Sorry about the delay, and thanks for the contribution!
Is there a way to make the
numpy
dependency optional? As far as I understand, the algorithm itself is implemented in Rust, andnumpy
is required just to make it possible to pass numpy arrays tosimplify_coords()
and return them back.numpy
is a heavyweight library, and I don't want my project to depend on it.