当前位置: 首页>>代码示例>>Python>>正文


Python Polygon.disjoint方法代码示例

本文整理汇总了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)
开发者ID:Toblerity,项目名称:Shapely,代码行数:21,代码来源:test_prepared.py

示例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())
开发者ID:imclab,项目名称:maptcha-v2,代码行数:38,代码来源:tile_map.py

示例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)                    
开发者ID:BGCX261,项目名称:zmetadata-svn-to-git,代码行数:26,代码来源:MetadataManager.py


注:本文中的shapely.geometry.Polygon.disjoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。