def createTiledGeoJsonFromSrc(rasterFolderLocation, vectorSrcFile, geoJsonOutputDirectory, rasterTileIndex='',
geoJsonPrefix='GEO', rasterFileExtenstion='.tif',
rasterPrefixToReplace='PAN'
):
if rasterTileIndex == '':
gTindex, gTindexLayer = buildTindex(rasterFolderLocation, rasterExtention=rasterFileExtenstion)
else:
gTindex = ogr.Open(rasterTileIndex,0)
gTindexLayer = gTindex.GetLayer()
shapeSrc = ogr.Open(vectorSrcFile,0)
chipSummaryList = []
for feature in gTindexLayer:
featureGeom = feature.GetGeometryRef()
rasterFileName = feature.GetField('location')
rasterFileBaseName = os.path.basename(rasterFileName)
outGeoJson = rasterFileBaseName.replace(rasterPrefixToReplace, geoJsonPrefix)
outGeoJson = outGeoJson.replace(rasterFileExtenstion, '.geojson')
outGeoJson = os.path.join(geoJsonOutputDirectory, outGeoJson)
gT.clipShapeFile(shapeSrc, outGeoJson, featureGeom, minpartialPerc=0.0, debug=False)
imageId = rasterFileBaseName.replace(rasterPrefixToReplace+"_", "")
chipSummary = {'chipName': rasterFileName,
'geoVectorName': outGeoJson,
'imageId': os.path.splitext(imageId)[0]}
chipSummaryList.append(chipSummary)
return chipSummaryList
externalVectorProcessing.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录