本文整理汇总了Python中osgeo.gdal.VersionInfo方法的典型用法代码示例。如果您正苦于以下问题:Python gdal.VersionInfo方法的具体用法?Python gdal.VersionInfo怎么用?Python gdal.VersionInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osgeo.gdal
的用法示例。
在下文中一共展示了gdal.VersionInfo方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_CAPPI
# 需要导入模块: from osgeo import gdal [as 别名]
# 或者: from osgeo.gdal import VersionInfo [as 别名]
def test_CAPPI(self):
gridder = vpr.CAPPI(
self.xyz,
self.trgxyz,
self.trgshape,
self.maxrange,
self.minelev,
self.maxelev,
)
out = gridder(self.data)
assert out.shape == (6084,)
# Todo: find out where this discrepancy comes from
from osgeo import gdal
if gdal.VersionInfo()[0] >= "3":
size = 3528
else:
size = 3512
assert len(np.where(np.isnan(out))[0]) == size
示例2: __init__
# 需要导入模块: from osgeo import gdal [as 别名]
# 或者: from osgeo.gdal import VersionInfo [as 别名]
def __init__(self, iface):
QObject.__init__(self)
QgsMessageLog.logMessage('GDAL Version: ' + str(gdal.VersionInfo('VERSION_NUM')), 'CartoDB Plugin', QgsMessageLog.INFO)
# Save reference to the QGIS interface
self.iface = iface
# initialize locale
locale = QSettings().value("locale/userLocale")[0:2]
localePath = os.path.join(CartoDBPlugin.PLUGIN_DIR, "i18n", "{}.qm".format(locale))
if os.path.exists(localePath):
self.translator = QTranslator()
self.translator.load(localePath)
if qVersion() > '4.3.3':
QCoreApplication.installTranslator(self.translator)
# SQLite available?
driverName = "SQLite"
self.sqLiteDrv = ogr.GetDriverByName(driverName)
if self.sqLiteDrv is None:
QgsMessageLog.logMessage('SQLite driver not found', 'CartoDB Plugin', QgsMessageLog.CRITICAL)
else:
QgsMessageLog.logMessage('SQLite driver is found', 'CartoDB Plugin', QgsMessageLog.INFO)
self.databasePath = CartoDBPlugin.PLUGIN_DIR + '/db/database.sqlite'
shutil.copyfile(CartoDBPlugin.PLUGIN_DIR + '/db/init_database.sqlite', self.databasePath)
self.layers = []
self.countLoadingLayers = 0
self.countLoadedLayers = 0
self._cdbMenu = None
self._mainAction = None
self._loadDataAction = None
self._createVizAction = None
self._addSQLAction = None
self.toolbar = CartoDBToolbar()
self._toolbarAction = None
self._menu = None
示例3: _run_tests
# 需要导入模块: from osgeo import gdal [as 别名]
# 或者: from osgeo.gdal import VersionInfo [as 别名]
def _run_tests(test_suite, package_name, with_coverage=False):
"""Core function to test a test suite."""
count = test_suite.countTestCases()
print('########')
print('%s tests has been discovered in %s' % (count, package_name))
print('Python GDAL : %s' % gdal.VersionInfo('VERSION_NUM'))
print('QT : {}'.format(QT_VERSION_STR))
print('########')
if with_coverage:
cov = coverage.Coverage(
source=['/processing_r'],
omit=['*/test/*'],
)
cov.start()
unittest.TextTestRunner(verbosity=3, stream=sys.stdout).run(test_suite)
if with_coverage:
cov.stop()
cov.save()
report = tempfile.NamedTemporaryFile(delete=False)
cov.report(file=report)
# Produce HTML reports in the `htmlcov` folder and open index.html
# cov.html_report()
report.close()
with open(report.name, 'r') as fin:
print(fin.read())
示例4: test_get_radar_projection
# 需要导入模块: from osgeo import gdal [as 别名]
# 或者: from osgeo.gdal import VersionInfo [as 别名]
def test_get_radar_projection(self):
sitecoords = [5, 52, 90]
p0 = georef.get_radar_projection(sitecoords)
if gdal.VersionInfo()[0] >= "3":
assert p0.GetName() == "Unknown Azimuthal Equidistant"
assert p0.IsProjected()
assert p0.IsSameGeogCS(georef.get_default_projection())
assert p0.GetNormProjParm("latitude_of_center") == sitecoords[1]
assert p0.GetNormProjParm("longitude_of_center") == sitecoords[0]
示例5: transform_geometry
# 需要导入模块: from osgeo import gdal [as 别名]
# 或者: from osgeo.gdal import VersionInfo [as 别名]
def transform_geometry(geom, dest_srs, **kwargs):
"""Perform geotransformation to given destination SpatialReferenceSystem
It transforms coordinates to a given destination osr spatial reference
if a geotransform is neccessary.
Parameters
----------
geom : ogr.geometry
dest_srs : osr.SpatialReference
Destination Projection
Keyword Arguments
-----------------
source_srs : osr.SpatialReference
Source Projection
Returns
-------
geom : ogr.Geometry
Transformed Geometry
"""
gsrs = geom.GetSpatialReference()
srs = kwargs.get("source_srs", gsrs)
# srs is None assume wgs84 lonlat, but warn too
if srs is None:
srs = projection.get_default_projection()
warnings.warn("geometry without spatial reference - assuming wgs84")
# transform if not the same spatial reference system
if not srs.IsSame(dest_srs):
if gsrs is None:
geom.AssignSpatialReference(srs)
gsrs = geom.GetSpatialReference()
if gdal.VersionInfo()[0] >= "3":
dest_srs.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
gsrs.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
geom.TransformTo(dest_srs)
return geom
示例6: proj4_to_osr
# 需要导入模块: from osgeo import gdal [as 别名]
# 或者: from osgeo.gdal import VersionInfo [as 别名]
def proj4_to_osr(proj4str):
"""Transform a proj4 string to an osr spatial reference object
Parameters
----------
proj4str : string
Proj4 string describing projection
Examples
--------
See :ref:`/notebooks/radolan/radolan_grid.ipynb#PROJ.4`.
"""
proj = osr.SpatialReference()
proj.ImportFromProj4(proj4str)
proj.AutoIdentifyEPSG()
if LooseVersion(gdal.VersionInfo("RELEASE_NAME")) < LooseVersion("3"):
proj.Fixup()
proj.FixupOrdering()
if proj.Validate() == ogr.OGRERR_CORRUPT_DATA:
raise ValueError(
"proj4str validates to 'ogr.OGRERR_CORRUPT_DATA'"
"and can't be imported as OSR object"
)
return proj
示例7: _run_tests
# 需要导入模块: from osgeo import gdal [as 别名]
# 或者: from osgeo.gdal import VersionInfo [as 别名]
def _run_tests(test_suite, package_name, with_coverage=False):
"""Core function to test a test suite."""
count = test_suite.countTestCases()
print('########')
print('%s tests has been discovered in %s' % (count, package_name))
print('Python GDAL : %s' % gdal.VersionInfo('VERSION_NUM'))
print('QT : %s' % Qt.QT_VERSION)
print('########')
if with_coverage:
cov = coverage.Coverage(
source=['/processing_r'],
omit=['*/test/*'],
)
cov.start()
unittest.TextTestRunner(verbosity=3, stream=sys.stdout).run(test_suite)
if with_coverage:
cov.stop()
cov.save()
report = tempfile.NamedTemporaryFile(delete=False)
cov.report(file=report)
# Produce HTML reports in the `htmlcov` folder and open index.html
# cov.html_report()
report.close()
with open(report.name, 'r') as fin:
print(fin.read())