gispathfinder
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from osgeo import ogr
from osgeo import gdal

#  get raster datasource
open_image = gdal.Open( "../geodata/cadaster_borders-2tone-black-white.png" )
input_band = open_image.GetRasterBand(3)

#  create output datasource
output_shp = "../geodata/data/cadaster_raster"
shp_driver = ogr.GetDriverByName("ESRI Shapefile")

# create output file name
output_shapefile = shp_driver.CreateDataSource( output_shp + ".shp" )
new_shapefile = output_shapefile.CreateLayer(output_shp, srs = None )

gdal.Polygonize(input_band, None, new_shapefile, -1, [], callback=None)
new_shapefile.SyncToDisk()

分类:

技术点:

相关文章:

  • 2021-05-11
  • 2021-06-12
  • 2021-08-28
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-26
  • 2022-12-23
  • 2021-05-12
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案