arcgisapi4.x3857转4326和视角监听

arcgisapi4.x3857转4326

arcgisapi4.x3857转4326

“esri/geometry/support/webMercatorUtils”,引入方法

参考官网连接https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-webMercatorUtils.html#xyToLngLat

使用如下:

//监听坐标变化
var handle = view.watch("camera.position", function (newValue, oldValue, propertyName, object) {
    // console.log(propertyName + " 从一个视角 " + oldValue + " 变成 " + newValue);
    console.log("新坐标x:" + newValue.x + " 新坐标y: " + newValue.y + " 新坐标z: " + newValue.z);
    //摩卡托转经纬度
    let lonlat = webMercatorUtils.xyToLngLat(newValue.x, newValue.y);
    console.log(lonlat, "经纬度");
});

视角监听

哈哈哈,,之前发过一个监听视角的,那个应该是实时的坐标,这个坐标好像没取对。仅供参考。

//监听fov
var handle3 = view.watch("camera.fov", function (newValue, oldValue, propertyName, object) {
    console.log(propertyName + " 从一个fov " + oldValue + " 变成 " + newValue);
});
// //监听heading
var handle1 = view.watch("camera.heading", function (newValue, oldValue, propertyName, object) {
    console.log(propertyName + " 从一个heading " + oldValue + " 变成 " + newValue);
});
// //监听tilt
var handle2 = view.watch("camera.tilt", function (newValue, oldValue, propertyName, object) {
    console.log(propertyName + " 从一个tilt " + oldValue + " 变成 " + newValue);
});
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值