Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は Python にかなり慣れていないので、この質問に対する答えはおそらく非常に単純ですが、あらゆる場所を調べて多くのことを試しましたが、答えが見つかりませんでした。
Shapely を使用してポリゴンを単純化すると、空のポリゴンになる場合があります。ポリゴンが空の場合、ポリゴンをポイントに置き換えたい。次のように機能するもの:
if mypoly is empty: mypoly = [(0,0)]
それが形の整ったポリゴンであることを考えると、空のポリゴンをチェックするために Shapely に組み込まれているmypolyを使用して、それが空であるかどうかをチェックできます。is_empty
mypoly
is_empty
from shapely.geometry import Point if mypoly.is_empty: mypoly = Point(0, 0)