A divisão do polígono com interseção automática retornou apenas um polígono em forma de forma no Python
Estou usando o Python 3.5 de 64 bits no Windows 7 de 64 bits, versão bem torneada 1.5.13.
Eu tenho o seguinte código que me retornou um polígono com interseção:
import numpy as np
from shapely.geometry import Polygon, MultiPolygon
import matplotlib.pyplot as plt
x = np.array([ 0.38517325, 0.40859912, 0.43296919, 0.4583215 , 0.4583215 ,
0.43296919, 0.40859912, 0.38517325, 0.36265506, 0.34100929])
y = np.array([ 62.5 , 56.17977528, 39.39698492, 0. ,
0. , 17.34605377, 39.13341671, 60.4180932 ,
76.02574417, 85.47008547])
polygon = Polygon(np.c_[x, y])
plt.plot(*polygon.exterior.xy)
Isto está correto. Depois tentei obter os dois polígonos individuais usandobuffer(0)
:
split_polygon = polygon.buffer(0)
plt.plot(*polygon.exterior.xy)
print(type(split_polygon))
plt.fill(*split_polygon.exterior.xy)
Infelizmente, ele retornou apenas dos dois polígonos:
Alguém poderia ajudar? Obrigado!