本文整理汇总了Python中Vector.Vector.layer_rasterization方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.layer_rasterization方法的具体用法?Python Vector.layer_rasterization怎么用?Python Vector.layer_rasterization使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector.Vector
的用法示例。
在下文中一共展示了Vector.layer_rasterization方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: preprocess_to_raster_precision
# 需要导入模块: from Vector import Vector [as 别名]
# 或者: from Vector.Vector import layer_rasterization [as 别名]
def preprocess_to_raster_precision(self, shp_pr, field_pr):
"""
Function to extract data in pixel of vectors. For that, it need to
save a shapefile, then rasterize it and get a final data matrix.
:param shp_pr: Input shapefile path
:type shp_pr: str
:param field_pr: Field name of the shapefile to rasterize
:type field_pr: str
"""
kwargs = {}
kwargs['rm_rast'] = 1 # To remove existing raster in the clip_raster function
opt = {}
opt['Remove'] = 1 # To remove existing vector
# Define vector
vector_pr = Vector(shp_pr, self.path_cut, **opt)
# Create the raster output path
img_pr = vector_pr.layer_rasterization(self.ex_raster, field_pr)
self.img_pr.append(clip_raster(img_pr, self.complete_validation_shp, **kwargs))
# Call the raster class to extract the image data
self.complete_img.append(RasterSat_by_date('', '', [0]))