官网

http://map.sogou.com/api/documentation/javascript/api2.5/index.html

常见问题

http://map.sogou.com/api/documentation/javascript/api2.5/qa.html

坐标体系

  • 搜狗地图 api 中支持两种坐标体系,经纬度坐标系「WGS-84」和墨卡托投影坐标系,前者单位是度,后者单位是米
  • API 调用者送入标准经纬度后,搜狗地图后台会负责处理坐标转换,叠加到地图上。 叠加后的坐标从视觉效果看基本没有偏移
  • 搜狗地图只支持送入经纬度,后台转换为搜狗地图坐标叠加到地图上,不支持将搜狗地图坐标转换为经纬度提供

Vue 中使用

  1. public/index.html 中引入地图资源

    1
    <script type="text/javascript" src="//api.map.sogou.com/maps/js/api_v2.5.1.js"></script>
  2. 业务页面

    1
    <div id="map_canvas" style="height: 500px;"></div>

    js 代码:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    created() {
    //地图实例化,加载标注点
    this.$nextTick(() => {
    var myLatlng = new sogou.maps.Point(11830111.12, 4615576.24);
    var myOptions = {
    zoom: 13,
    center: myLatlng,
    mapTypeId: sogou.maps.MapTypeId.EDUSHIMAP
    // mapTypeId: sogou.maps.MapTypeId.TERRAIN
    }
    let map = new sogou.maps.Map(document.getElementById("map_canvas"), myOptions);

    var image = '//api.map.sogou.com/maps/images/v2.0/S20.png';
    var myLatLng = new sogou.maps.LatLng(38.48078810991786, 106.28755723970252);
    var beachMarker = new sogou.maps.Marker({
    position: myLatLng,
    map: map,
    icon: image
    });
    });
    }

搜狗地图坐标与经纬度坐标转换

1