While computing the difference between a single-segment LineString Z with a Polygon which happens to share a vertex (but otherwise isn't overlapping), the resulting LineString has one of the Z coordinate altered.
Here is the geometry:

Here is how to reproduce:
import numpy as np
import matplotlib.pyplot as plt
from shapely.wkt import loads, dumps
def main():
ls = loads(
"LINESTRING Z (-0.08365735370739519 0.08221315533414053 -1.010732607765682, -0.1533588930799144 0.0653358494958651 -1.010390339846296)"
)
p = loads(
"POLYGON ((-0.2239294216623028 -0.01825216019427908, -0.1515331919718202 -0.03513918728914136, -0.1533588930799144 0.0653358494958651, -0.2239294216623028 -0.01825216019427908))"
)
result = ls.difference(p)
plt.plot(*ls.coords.xy, 'r-')
plt.plot(*p.boundary.xy, 'g-')
plt.axis("equal")
plt.show()
print(dumps(result))
print(np.array(result) == np.array(ls))
if __name__ == "__main__":
main()
...and the result:
LINESTRING Z (-0.0836573537073952 0.0822131553341405 -1.0107326077656820, -0.1533588930799144 0.0653358494958651 -1.0107326077656820)
[[ True True True]
[ True True False]]
Am I missing something or is this a bug? (macOS 10.14.6, MacPort's Python 3.7.4, Shapely 1.6.4.post2)
While computing the difference between a single-segment
LineString Zwith aPolygonwhich happens to share a vertex (but otherwise isn't overlapping), the resultingLineStringhas one of the Z coordinate altered.Here is the geometry:
Here is how to reproduce:
...and the result:
Am I missing something or is this a bug? (macOS 10.14.6, MacPort's Python 3.7.4, Shapely 1.6.4.post2)