美文网首页
vue + SuperMap iClient(Leaflet)

vue + SuperMap iClient(Leaflet)

作者: 子夜照弦歌 | 来源:发表于2021-04-09 11:18 被阅读0次

接这篇文章:https://www.jianshu.com/p/03ad118cc52c
调用文档:https://leafletjs.com/reference-1.7.1.html#marker

    map.on("click", function (evt) {
        // console.log(evt);
        let lat = evt.latlng.lat,
          lng = evt.latlng.lng;
        // console.log(lat, lng);
        var geoDecodeParam = new SuperMap.GeoDecodingParameter({
          filters: "",
          fromIndex: "0",
          geoDecodingRadius: "-1",
          maxReturn: "-1",
          prjCoordSys: "{epsgcode:4326}",
          toIndex: "10",
          x: lng,
          y: lat,
        });
        addressMatchService.decode(geoDecodeParam, function (result) {
          // 此处为获取的地址经纬度相关信息
          // console.log(result);
          if (result.result.length > 0) {
            // console.log(result.result[0]);

            // _this.form.coordX = lng;
            // _this.form.coordY = lat;
           //  _this.form.casePosition = result.result[0].address;
            // _this.drawer = false;
          } else {
            _this.$message({
              message: "未解析出地址,请重新选择",
              type: "warning",
            });
          }
          // map.setView(L.latLng(39.914714, 116.383572), 10);
        });
      });

相关文章

网友评论

      本文标题:vue + SuperMap iClient(Leaflet)

      本文链接:https://www.haomeiwen.com/subject/fepvkltx.html