本文整理汇总了Python中rasterio.features.bounds函数的典型用法代码示例。如果您正苦于以下问题:Python bounds函数的具体用法?Python bounds怎么用?Python bounds使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bounds函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_bounds_existing_bbox
def test_bounds_existing_bbox(basic_featurecollection):
"""Test with existing bbox in geojson.
Similar to that produced by rasterio. Values specifically modified here
for testing, bboxes are not valid as written.
"""
fc = basic_featurecollection
fc['bbox'] = [0, 10, 10, 20]
fc['features'][0]['bbox'] = [0, 100, 10, 200]
assert bounds(fc['features'][0]) == (0, 100, 10, 200)
assert bounds(fc) == (0, 10, 10, 20)
示例2: test_feature_collection
def test_feature_collection():
fc = {
'features': [{
'geometry': {
'coordinates': [
[[-107, 40], [-106, 40], [-106, 41], [-107, 41], [-107, 40]]
],
'type': 'Polygon'
},
'type': 'Feature'
}],
'type': 'FeatureCollection'
}
assert bounds(fc['features'][0]) == (-107, 40, -106, 41)
assert bounds(fc) == (-107, 40, -106, 41)
示例3: test_bounds_existing_bbox
def test_bounds_existing_bbox():
""" Test with existing bbox in geojson, similar to that produced by
rasterio. Values specifically modified here for testing, bboxes are not
valid as written.
"""
fc = {
'bbox': [-107, 40, -105, 41],
'features': [{
'bbox': [-107, 40, -104, 42],
'geometry': {
'coordinates': [
[[-107, 40], [-106, 40], [-106, 41], [-107, 41], [-107, 40]]
],
'type': 'Polygon'
},
'type': 'Feature'
}],
'type': 'FeatureCollection'
}
assert bounds(fc['features'][0]) == (-107, 40, -104, 42)
assert bounds(fc) == (-107, 40, -105, 41)
示例4: test_feature_collection
def test_feature_collection(basic_featurecollection):
fc = basic_featurecollection
assert bounds(fc) == bounds(fc['features'][0]) == (2, 2, 4.25, 4.25)
示例5: test_bounds_invalid_obj
def test_bounds_invalid_obj():
with pytest.raises(KeyError):
bounds({'type': 'bogus', 'not_coordinates': []})
示例6: test_bounds_z
def test_bounds_z():
g = {'type': 'Point', 'coordinates': [10, 10, 10]}
assert bounds(g) == (10, 10, 10, 10)
示例7: test_bounds_polygon
def test_bounds_polygon():
g = {'type': 'Polygon', 'coordinates': [[[0, 0], [10, 10], [10, 0]]]}
assert bounds(g) == (0, 0, 10, 10)
示例8: test_bounds_line
def test_bounds_line():
g = {'type': 'LineString', 'coordinates': [[0, 0], [10, 10]]}
assert bounds(g) == (0, 0, 10, 10)
示例9: test_bounds_z
def test_bounds_z():
g = {'type': 'Point', 'coordinates': [10, 10, 10]}
assert bounds(g) == (10, 10, 10, 10)
assert bounds(MockGeoInterface(g)) == (10, 10, 10, 10)
示例10: test_bounds_ring
def test_bounds_ring():
g = {'type': 'LinearRing', 'coordinates': [[0, 0], [10, 10], [10, 0]]}
assert bounds(g) == (0, 0, 10, 10)
assert bounds(MockGeoInterface(g)) == (0, 0, 10, 10)