【发布时间】:2017-04-14 09:08:31
【问题描述】:
我有一个用 OpenTripPlanner 生成的等时多边形:
{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"MultiPolygon","coordinates":[]},"properties":{"time":-47},"id":"fid--576b228b_15b66d32d71_-7cbd"}]}
这个多边形被翻译成一个 Shapely 对象,指令如下:
isochrone = shapely.geometry.asShape(isochroneJSON['features'][0]['geometry'])
这就是它在 Spyder 中的样子:
{u'type': u'FeatureCollection', u'features': [{u'geometry': {u'type': u'MultiPolygon', u'coordinates': []}, u'type': u'Feature', u'properties': {u'time': -47}, u'id': u'fid--576b228b_15b66d32d71_-7a54'}]}
在我看来,它真的像一个空的多边形。我的问题是我想将它排除在我的其余治疗之外,并检查它是否有效和/或为空。以及以下指令:
if not isochrone.is_empty:
使用 .is_empty shapely 指令生成错误:
return (self._geom is None) or bool(self.impl['is_empty'](self))
self.__geom__, n = self.factory(self.context)
我完全迷失了,因为the only similar question 似乎没有我自己的问题。
【问题讨论】:
标签: python polygon shapely opentripplanner