首页 > 其他 > 详细

栅格转矢量

时间:2016-08-07 13:49:47      阅读:296      评论:0      收藏:0      [点我收藏+]
#!/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()

栅格转矢量

原文:http://www.cnblogs.com/gispathfinder/p/5745952.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!