本文整理汇总了Python中shapely.geometry.Polygon.disjoint方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.disjoint方法的具体用法?Python Polygon.disjoint怎么用?Python Polygon.disjoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shapely.geometry.Polygon
的用法示例。
在下文中一共展示了Polygon.disjoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_prepared_predicates
# 需要导入模块: from shapely.geometry import Polygon [as 别名]
# 或者: from shapely.geometry.Polygon import disjoint [as 别名]
def test_prepared_predicates():
# check prepared predicates give the same result as regular predicates
polygon1 = Polygon([
(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)
])
polygon2 = Polygon([
(0.5, 0.5), (1.5, 0.5), (1.0, 1.0), (0.5, 0.5)
])
point2 = Point(0.5, 0.5)
polygon_empty = Polygon()
prepared_polygon1 = PreparedGeometry(polygon1)
for geom2 in (polygon2, point2, polygon_empty):
assert polygon1.disjoint(geom2) == prepared_polygon1.disjoint(geom2)
assert polygon1.touches(geom2) == prepared_polygon1.touches(geom2)
assert polygon1.intersects(geom2) == prepared_polygon1.intersects(geom2)
assert polygon1.crosses(geom2) == prepared_polygon1.crosses(geom2)
assert polygon1.within(geom2) == prepared_polygon1.within(geom2)
assert polygon1.contains(geom2) == prepared_polygon1.contains(geom2)
assert polygon1.overlaps(geom2) == prepared_polygon1.overlaps(geom2)
示例2: cut_map_tiles
# 需要导入模块: from shapely.geometry import Polygon [as 别名]
# 或者: from shapely.geometry.Polygon import disjoint [as 别名]
def cut_map_tiles(src_name, queue, ul, ur, lr, ll, max_zoom):
'''
'''
coords = [Coordinate(0, 0, 0)]
radius = pi * 6378137
map_bounds = Polygon([(ul.x, ul.y), (ur.x, ur.y), (lr.x, lr.y), (ll.x, ll.y), (ul.x, ul.y)])
while coords:
coord = coords.pop(0)
xmin, ymin, xmax, ymax = coord2bbox(coord)
tile_bounds = Polygon([(xmin, ymax), (xmax, ymax), (xmax, ymin), (xmin, ymin), (xmin, ymax)])
if tile_bounds.disjoint(map_bounds):
continue
tilename = join(dirname(src_name), 'tile-%(zoom)d-%(column)d-%(row)d.tif' % coord.__dict__)
cmd = 'gdalwarp -r cubicspline -dstalpha -ts 256 256'.split()
cmd += ('-te %(xmin).6f %(ymin).6f %(xmax).6f %(ymax).6f' % locals()).split()
cmd += [src_name, tilename] #'-overwrite',
#print "%s"%cmd
cmd = Popen(cmd, stdout=PIPE, stderr=PIPE)
cmd.wait()
if cmd.returncode != 0:
print cmd.stderr.read()
raise Exception('Error in gdalwarp')
queue.put((coord, tilename))
if coord.zoom < max_zoom:
coords.append(coord.zoomBy(1))
coords.append(coord.zoomBy(1).right())
coords.append(coord.zoomBy(1).right().down())
coords.append(coord.zoomBy(1).down())
示例3: checkExtent
# 需要导入模块: from shapely.geometry import Polygon [as 别名]
# 或者: from shapely.geometry.Polygon import disjoint [as 别名]
def checkExtent(self, metaExtent, checkExtent, operation):
"""
@summary: checks polygons against operation
@param metaExtent: list in the format [minx,miny,maxx,maxy]
@param checkExtent: list in the format [minx,miny,maxx,maxy]
"""
metaExtent = [float(x) for x in metaExtent]
checkExtent = [float(x) for x in checkExtent]
metaPoly = Polygon(((metaExtent[0],metaExtent[1]), (metaExtent[0],metaExtent[3]), (metaExtent[2],metaExtent[3]), (metaExtent[2],metaExtent[1])))
checkPoly = Polygon(((checkExtent[0],checkExtent[1]), (checkExtent[0],checkExtent[3]), (checkExtent[2],checkExtent[3]), (checkExtent[2],checkExtent[1])))
if operation == "Contains":
return checkPoly.contains(metaPoly)
if operation == "Intersects":
return checkPoly.intersects(metaPoly)
if operation == "Equals":
return checkPoly.equals(metaPoly)
if operation == "Touches":
return checkPoly.touches(metaPoly)
if operation == "Within":
return checkPoly.within(metaPoly)
if operation == "Outside":
return checkPoly.disjoint(metaPoly)