本文整理汇总了Python中nansat.vrt.VRT.get_projection方法的典型用法代码示例。如果您正苦于以下问题:Python VRT.get_projection方法的具体用法?Python VRT.get_projection怎么用?Python VRT.get_projection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nansat.vrt.VRT
的用法示例。
在下文中一共展示了VRT.get_projection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_projection_raises_NansatProjectionError
# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import get_projection [as 别名]
def test_get_projection_raises_NansatProjectionError(self, dataset):
dataset.GetProjection.return_value = ''
dataset.GetGCPProjection.return_value = ''
dataset.GetMetadata.return_value = {}
vrt = VRT()
with self.assertRaises(NansatProjectionError):
proj = vrt.get_projection()
示例2: test_get_projection_geolocation
# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import get_projection [as 别名]
def test_get_projection_geolocation(self, dataset):
proj = 'SOME_PROJECTION'
dataset.GetProjection.return_value = ''
dataset.GetGCPProjection.return_value = ''
dataset.GetMetadata.return_value = {'SRS': proj}
vrt = VRT()
proj_src = vrt.get_projection()
self.assertEqual(proj_src, (proj, 'geolocation'))
示例3: test_get_projection_dataset
# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import get_projection [as 别名]
def test_get_projection_dataset(self, dataset):
proj = 'SOME_PROJECTION'
dataset.GetProjection.return_value = proj
dataset.GetGCPProjection.return_value = ''
dataset.GetMetadata.return_value = {}
vrt = VRT()
proj_src = vrt.get_projection()
self.assertEqual(proj_src, (proj, 'dataset'))
示例4: Domain
# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import get_projection [as 别名]
#.........这里部分代码省略.........
rasterXSize, rasterYSize] = self._get_geotransform(extentDic)
# create VRT object with given geo-reference parameters
self.vrt = VRT(srcGeoTransform=geoTransform,
srcProjection=srs.wkt,
srcRasterXSize=rasterXSize,
srcRasterYSize=rasterYSize)
self.extentDic = extentDic
elif lat is not None and lon is not None:
# create self.vrt from given lat/lon
self.vrt = VRT(lat=lat, lon=lon)
else:
raise OptionError('"dataset" or "srsString and extentString" '
'or "dataset and srsString" are required')
self.logger.debug('vrt.dataset: %s' % str(self.vrt.dataset))
def __repr__(self):
'''Creates string with basic info about the Domain object
Modifies
---------
Print size, projection and corner coordinates
'''
outStr = 'Domain:[%d x %d]\n' % (self.vrt.dataset.RasterXSize,
self.vrt.dataset.RasterYSize)
outStr += '-' * 40 + '\n'
try:
corners = self.get_corners()
except:
self.logger.error('Cannot read projection from source!')
else:
outStr += 'Projection:\n'
outStr += (NSR(self.vrt.get_projection()).ExportToPrettyWkt(1)
+ '\n')
outStr += '-' * 40 + '\n'
outStr += 'Corners (lon, lat):\n'
outStr += '\t (%6.2f, %6.2f) (%6.2f, %6.2f)\n' % (corners[0][0],
corners[1][0],
corners[0][2],
corners[1][2])
outStr += '\t (%6.2f, %6.2f) (%6.2f, %6.2f)\n' % (corners[0][1],
corners[1][1],
corners[0][3],
corners[1][3])
return outStr
def write_kml(self, xmlFileName=None, kmlFileName=None):
'''Write KML file with domains
Convert XML-file with domains into KML-file for GoogleEarth
or write KML-file with the current Domain
Parameters
-----------
xmlFileName : string, optional
Name of the XML-file to convert. If only this value is given
- kmlFileName=xmlFileName+'.kml'
kmlFileName : string, optional
Name of the KML-file to generate from the current Domain
'''
# test input options
if xmlFileName is not None and kmlFileName is None:
# if only input XML-file is given - convert it to KML