本文整理匯總了Python中safe.storage.raster.Raster.as_qgis_native方法的典型用法代碼示例。如果您正苦於以下問題:Python Raster.as_qgis_native方法的具體用法?Python Raster.as_qgis_native怎麽用?Python Raster.as_qgis_native使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類safe.storage.raster.Raster
的用法示例。
在下文中一共展示了Raster.as_qgis_native方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_convert_to_qgis_raster_layer
# 需要導入模塊: from safe.storage.raster import Raster [as 別名]
# 或者: from safe.storage.raster.Raster import as_qgis_native [as 別名]
def test_convert_to_qgis_raster_layer(self):
"""Test that converting to QgsVectorLayer works."""
if qgis_imported:
# Create vector layer
keywords = read_keywords(RASTER_BASE + '.keywords')
layer = Raster(data=RASTER_BASE + '.tif', keywords=keywords)
# Convert to QgsRasterLayer
qgis_layer = layer.as_qgis_native()
qgis_extent = qgis_layer.dataProvider().extent()
qgis_extent = [qgis_extent.xMinimum(), qgis_extent.yMinimum(),
qgis_extent.xMaximum(), qgis_extent.yMaximum()]
layer_exent = layer.get_bounding_box()
self.assertListEqual(
layer_exent, qgis_extent,
'Expected %s extent, got %s' % (qgis_extent, layer_exent))