特征和几何有关系,你不想破坏

特征和几何有关系,你不想破坏
发布日期: 2016-10-06 更新日期: 1970-01-01 编辑:yubiao 浏览次数: 3263

标签:
 from osgeo import ogr
dSource = ogr.Open( "parcel_address.shp" )
if dSource is None:
    print "[ ERROR ]: datasource cannot be opened"
layer = dSource.GetLayer()
geom_collection = []

#
#  collect just the geometries
#  notice that we are losing reference
#  each geometry's parent feat though
#
for feat in layer:
    geom = feat.GetGeometryRef()
    geom_collection.append( geom )

#
#  try to print the
#  geometries collected
#
for g in geom_collection:
    print g.ExportToWkt()

    <..PYTHON CRASHES..>
说明:

官方的陷阱对为什么Python崩溃时删除,还有几何参考使用具有良好的部分。他们甚至谈论如何转化为基本的C++参考。更微妙的情况下发生时,你松散的引用的功能,而不删除它的例子如下所示。


Copyright © Since 2014. 开源地理空间基金会中文分会 吉ICP备05002032号

Powered by TorCMS

OSGeo 中国中心 邮件列表

问题讨论 : 要订阅或者退订列表,请点击 订阅

发言 : 请写信给: osgeo-china@lists.osgeo.org