zoukankan      html  css  js  c++  java
  • 测试百度地图输入GPS经纬度显示位置API

    1.我的GPS获取的经纬度做度分秒转换后为

    34.636055,112.40832

    2.百度API介绍

    GPS的坐标是WGS84,所以测试API

    http://api.map.baidu.com/geocoder?location=34.636055,112.40832&coord_type=wgs84&output=html&src=waaax|GPSTest
    

    可以用浏览器打开或者做app访问

    3.用python测试api

    效果

    测试代码

    # -*- coding: utf-8 -*-
    
    """
    Module implementing BaiduMap.
    """
    
    from PyQt4.QtCore import pyqtSignature
    from PyQt4.QtGui import QDialog
    
    from Ui_main_ui import Ui_Dialog
    
    #添加
    from PyQt4 import QtCore, QtGui
    import sys
    
    # 设备ID
    LAT = '34.636055'
    # 数据流名称
    LON = '112.40832'
    
    class BaiduMap(QDialog, Ui_Dialog):
        """
        Class documentation goes here.
        """
        def __init__(self, parent=None):
            """
            Constructor
            
            @param parent reference to the parent widget
            @type QWidget
            """
            QDialog.__init__(self, parent)
            self.setupUi(self)
    
            address = "http://api.map.baidu.com/geocoder?location=%s,%s&coord_type=wgs84&output=html&src=yourCompanyName|yourAppName"%(LAT,LON)
    
            url = QtCore.QUrl(address)
            self.webView.load(url)
    
    
    if __name__ == '__main__':
        app = QtGui.QApplication(sys.argv)
        mycalc = BaiduMap()
        mycalc.show()
        sys.exit(app.exec_())
    
  • 相关阅读:
    os.environ()详解
    查看django setting 源码
    FBV or CBV django settings 源码 模板层语法 摸板的继承 摸板的导入
    jq
    centos安装docker
    idea mapper报红解决
    Method has too many Body parameters
    Gradle安装配置
    itext生成PDF报错java.io.IOException: The document has no pages
    数字千分位
  • 原文地址:https://www.cnblogs.com/Mysterious/p/8481122.html
Copyright © 2011-2022 走看看