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


Python QgsPoint.toDegreesMinutesSeconds方法代码示例

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


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

示例1: testSubstitutionMap

# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint 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 = QgsPoint(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(self.iface.mapCanvas().mapRenderer())
        mySubstitutionMap = {'replace-me': myText}
        myFile = os.path.join(TEST_DATA_DIR, 'template-for-substitution.qpt')
        myTemplateFile = file(myFile, 'rt')
        myTemplateContent = myTemplateFile.read()
        myTemplateFile.close()
        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:Antoviscomi,项目名称:QGIS,代码行数:28,代码来源:test_qgscomposition.py

示例2: event_dict

# 需要导入模块: from qgis.core import QgsPoint [as 别名]
# 或者: from qgis.core.QgsPoint import toDegreesMinutesSeconds [as 别名]
 def event_dict(self):
     tz = pytz.timezone("Asia/Jakarta")
     timestamp = self.time.astimezone(tz=tz)
     time_format = "%-d-%b-%Y %H:%M:%S"
     timestamp_string = timestamp.strftime(time_format)
     point = QgsPoint(self.longitude, self.latitude)
     coordinates = point.toDegreesMinutesSeconds(2)
     tokens = coordinates.split(",")
     longitude_string = tokens[0]
     latitude_string = tokens[1]
     elapsed_time = datetime.datetime.utcnow().replace(tzinfo=pytz.utc) - self.time
     elapsed_hour = elapsed_time.seconds / 3600
     elapsed_minute = (elapsed_time.seconds / 60) % 60
     event = {
         "report-title": self.tr("Volcanic Ash Impact"),
         "report-timestamp": self.tr("Volcano: %s, Alert Level: %s %s")
         % (self.volcano_name, self.alert_level, timestamp_string),
         "report-province": self.tr("Province: %s") % (self.region,),
         "report-location": self.tr("Longitude %s Latitude %s;" " Eruption Column Height (a.s.l) - %d m")
         % (longitude_string, latitude_string, self.erupction_height),
         "report-elapsed": self.tr("Elapsed time since event %s hour(s) and %s minute(s)")
         % (elapsed_hour, elapsed_minute),
         "header-impact-table": self.tr("Potential impact at each fallout level"),
         "header-nearby-table": self.tr("Nearby places"),
         "header-landcover-table": self.tr("Land Cover Impact"),
         "content-disclaimer": self.tr(
             "The impact estimation is automatically generated and only "
             "takes into account the population, cities and land cover "
             "affected by different levels of volcanic ash fallout at "
             "surface level. The estimate is based on volcanic ash "
             "fallout data from Badan Geologi, population count data "
             "derived by DMInnovation from worldpop.org.uk, place "
             "information from geonames.org, land cover classification "
             "data provided by Indonesian Geospatial Portal at "
             "http://portal.ina-sdi.or.id and software developed by BNPB. "
             "Limitation in the estimates of surface fallout, population "
             "and place names datasets may result in significant "
             "misrepresentation of the on-the-surface situation in the "
             "figures shown here. Consequently decisions should not be "
             "made soley on the information presented here and should "
             "always be verified by ground truthing and other reliable "
             "information sources."
         ),
         "content-notes": self.tr(
             "This report was created using InaSAFE version %s. Visit " "http://inasafe.org for more information. "
         )
         % get_version(),
     }
     return event
开发者ID:,项目名称:,代码行数:51,代码来源:


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