def import_summary_geojson(geojsonfilename, removeNoBuildings=True):
# driver = ogr.GetDriverByName('geojson')
datasource = ogr.Open(geojsonfilename, 0)
layer = datasource.GetLayer()
print(layer.GetFeatureCount())
buildingList = []
for idx, feature in enumerate(layer):
poly = feature.GetGeometryRef()
if poly:
if removeNoBuildings:
if feature.GetField('BuildingId') != -1:
buildingList.append({'ImageId': feature.GetField('ImageId'), 'BuildingId': feature.GetField('BuildingId'),
'poly': feature.GetGeometryRef().Clone()})
else:
buildingList.append({'ImageId': feature.GetField('ImageId'), 'BuildingId': feature.GetField('BuildingId'),
'poly': feature.GetGeometryRef().Clone()})
return buildingList
评论列表
文章目录