本文整理汇总了Python中osgeo.ogr.UseExceptions方法的典型用法代码示例。如果您正苦于以下问题:Python ogr.UseExceptions方法的具体用法?Python ogr.UseExceptions怎么用?Python ogr.UseExceptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osgeo.ogr
的用法示例。
在下文中一共展示了ogr.UseExceptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: insertFrame
# 需要导入模块: from osgeo import ogr [as 别名]
# 或者: from osgeo.ogr import UseExceptions [as 别名]
def insertFrame(self, scale, mi, inom, frame):
self.checkAndOpenDb()
srid = self.findEPSG()
geoSrid = QgsCoordinateReferenceSystem(int(srid)).geographicCRSAuthId().split(':')[-1]
ogr.UseExceptions()
outputDS = self.buildOgrDatabase()
outputLayer=outputDS.GetLayerByName('public_aux_moldura_a')
newFeat=ogr.Feature(outputLayer.GetLayerDefn())
auxGeom = ogr.CreateGeometryFromWkb(frame)
#set geographic srid from frame
geoSrs = ogr.osr.SpatialReference()
geoSrs.ImportFromEPSG(int(geoSrid))
auxGeom.AssignSpatialReference(geoSrs)
#reproject geom
outSpatialRef = outputLayer.GetSpatialRef()
coordTrans = osr.CoordinateTransformation(geoSrs, outSpatialRef)
auxGeom.Transform(coordTrans)
newFeat.SetGeometry(auxGeom)
newFeat.SetField('mi', mi)
newFeat.SetField('inom', inom)
newFeat.SetField('escala', str(scale))
out=outputLayer.CreateFeature(newFeat)
outputDS.Destroy()
示例2: insertFrame
# 需要导入模块: from osgeo import ogr [as 别名]
# 或者: from osgeo.ogr import UseExceptions [as 别名]
def insertFrame(self, scale, mi, inom, frame):
self.checkAndOpenDb()
srid = self.findEPSG()
geoSrid = QgsCoordinateReferenceSystem(int(srid)).geographicCRSAuthId().split(':')[-1]
ogr.UseExceptions()
outputDS = self.buildOgrDatabase()
outputLayer=outputDS.GetLayerByName(self.getFrameLayerName())
newFeat=ogr.Feature(outputLayer.GetLayerDefn())
auxGeom = ogr.CreateGeometryFromWkb(frame)
#set geographic srid from frame
geoSrs = ogr.osr.SpatialReference()
geoSrs.ImportFromEPSG(int(geoSrid))
auxGeom.AssignSpatialReference(geoSrs)
#reproject geom
outSpatialRef = outputLayer.GetSpatialRef()
coordTrans = osr.CoordinateTransformation(geoSrs, outSpatialRef)
auxGeom.Transform(coordTrans)
newFeat.SetGeometry(auxGeom)
newFeat.SetField('mi', mi)
newFeat.SetField('inom', inom)
newFeat.SetField('escala', str(scale))
out=outputLayer.CreateFeature(newFeat)
outputDS.Destroy()
示例3: has_geos
# 需要导入模块: from osgeo import ogr [as 别名]
# 或者: from osgeo.ogr import UseExceptions [as 别名]
def has_geos():
pnt1 = ogr.CreateGeometryFromWkt("POINT(10 20)")
pnt2 = ogr.CreateGeometryFromWkt("POINT(30 20)")
ogrex = ogr.GetUseExceptions()
gdalex = gdal.GetUseExceptions()
gdal.DontUseExceptions()
ogr.DontUseExceptions()
hasgeos = pnt1.Union(pnt2) is not None
if ogrex:
ogr.UseExceptions()
if gdalex:
gdal.UseExceptions()
return hasgeos