def mutiSearchPlace(self):
envelope=polygon_target.envelope
bounds=list(envelope.bounds)
# ????
bounds[0] -= 0.02
parts = 50
# ?????4?????16???
boundsList = GeoUtil().getBoundsList(bounds, parts)
threads = []
# ???????????16?????????????
for index in range(0, len(boundsList)/16+1, 1):
for threadIndex in range(index*16,(index+1)*16):
if threadIndex < len(boundsList):
print 'current bounds ...%s ' % threadIndex
subBounds = boundsList[threadIndex]
# ?extent???polygon
coords=GeoUtil().getPolygonByExtent(subBounds)
coords=tuple(coords)
isIntersects=Polygon((coords)).intersects(polygon_target)
if isIntersects:
threads.append(gevent.spawn(self.fetchPlaceDetail, threadIndex%16, subBounds))
gevent.joinall(threads)
评论列表
文章目录