MsHibiscus

1,首先需要引进官方的js:

1 <script  type="text/javascript" src="http://api.tianditu.gov.cn/api?v=4.0&tk=密钥" ></script>

2,创建放地图的容器,并设置好id和容器的大小

<div id="mapDiv"></div>

3,加载基本底图

  

createdMap: function () {
      var that = this;
      this.map = new T.Map("mapDiv");
 

      //设置显示地图的中心点和级别
      //zoom缩放等级
       this. map.centerAndZoom(new T.LngLat(116.40969, 39.89945), zoom);

                //创建图片对象
            var icon = new T.Icon({
              iconUrl: that.imgUrl,//图片地址
              iconSize: new T.Point(19, 27),
              iconAnchor: new T.Point(10, 25)
            });
            //向地图上添加自定义标注
            var marker = new T.Marker(new T.LngLat(lon, lat), {
              icon: icon
            });
            this.map.addOverLay(marker);

      });

 

分类:

技术点:

相关文章:

  • 2021-11-25
  • 2021-12-02
  • 2022-12-23
  • 2021-09-09
  • 2022-02-09
  • 2022-02-02
  • 2021-10-06
  • 2021-04-12
猜你喜欢
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
相关资源
相似解决方案