当前位置: 首页>>代码示例>>Python>>正文


Python QgsPointXY.toDegreesMinutesSeconds方法代码示例

本文整理汇总了Python中qgis.core.QgsPointXY.toDegreesMinutesSeconds方法的典型用法代码示例。如果您正苦于以下问题:Python QgsPointXY.toDegreesMinutesSeconds方法的具体用法?Python QgsPointXY.toDegreesMinutesSeconds怎么用?Python QgsPointXY.toDegreesMinutesSeconds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qgis.core.QgsPointXY的用法示例。


在下文中一共展示了QgsPointXY.toDegreesMinutesSeconds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testSubstitutionMap

# 需要导入模块: from qgis.core import QgsPointXY [as 别名]
# 或者: from qgis.core.QgsPointXY import toDegreesMinutesSeconds [as 别名]
    def testSubstitutionMap(self):
        """Test that we can use degree symbols in substitutions.
        """
        # Create a point and convert it to text containing a degree symbol.
        myPoint = QgsPointXY(12.3, -33.33)
        myCoordinates = myPoint.toDegreesMinutesSeconds(2)
        myTokens = myCoordinates.split(',')
        myLongitude = myTokens[0]
        myLatitude = myTokens[1]
        myText = 'Latitude: %s, Longitude: %s' % (myLatitude, myLongitude)

        # Load the composition with the substitutions
        myComposition = QgsComposition(QgsProject.instance())
        mySubstitutionMap = {'replace-me': myText}
        myFile = os.path.join(TEST_DATA_DIR, 'template-for-substitution.qpt')
        with open(myFile) as f:
            myTemplateContent = f.read()
        myDocument = QDomDocument()
        myDocument.setContent(myTemplateContent)
        myComposition.loadFromTemplate(myDocument, mySubstitutionMap)

        # We should be able to get map0
        myMap = myComposition.getComposerMapById(0)
        myMessage = ('Map 0 could not be found in template %s', myFile)
        assert myMap is not None, myMessage
开发者ID:giohappy,项目名称:QGIS,代码行数:27,代码来源:test_qgscomposition.py


注:本文中的qgis.core.QgsPointXY.toDegreesMinutesSeconds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。