urschrei / simplification

Very fast Python line simplification using either the RDP or Visvalingam-Whyatt algorithm implemented in Rust
Other
168 stars 18 forks source link

3D line? #3

Closed soichih closed 4 years ago

soichih commented 5 years ago

Is there anyway to make this library work on 3D data?

urschrei commented 5 years ago

It would depend on where you were storing the z values (something like [[x, y, z], …]?), and even then, the underlying library (Rust-Geo) would have to return the indices of the simplified values as opposed to a simplified copy (which is doable, but not what it currently does).

Jakobovski commented 5 years ago

Are there any other 3d polyline simplification libraries?

urschrei commented 5 years ago

@Jakobovski Shapely supports Point objects with a z coordinate.

Jakobovski commented 5 years ago

Also this I just found https://github.com/fhirschmann/rdp

soichih commented 5 years ago

I tried rdp and it worked, but it was way too slow. I don't think I have tried shapely, but has anyone tried it with many(>100k) 3D lines?

urschrei commented 5 years ago

@soichih Shapely uses GEOS for its geometric operations, and it's quite heavily optimised (you may want to turn off topology preservation in the Shapely call for maximum speed). It depends on how many vertices are in your lines, the context in which you're converting them (is it a web app, or a command-line app etc).