您的位置:首页 > Web前端 > JavaScript

[置顶] arcgis api for js入门开发系列十一 量算工具模块(含源代码)

2017-02-19 08:03 363 查看
众所周知,使用arcgis api for js实现地图的量算工具功能,无非是调用arcgisserver的Geometry服务(http://localhost:6080/arcgis/rest/services/Utilities/Geometry/GeometryServer)提供的Areas and Lengths以及Lengths,如图:



但是我这里提供另一种实现的思路,就是自己写算法来实现距离以及面积的量算,这样的好处是不依赖arcgisserver几何服务,有些项目不排除有些奇特的客户不用Geometry服务的,最终的实现效果图如下:



具体实现思路:创建一个独立的js文件,里面有量算工具类DCIMeature,DCIMeature类构造函数传入地图对象map

construct: function (map) {
this._dciMap = map;
this._onClickHandler = dojo.hitch(this, this._onClickHandler);
this._onMouseMoveHandler = dojo.hitch(this, this._onMouseMoveHandler);
this._onDrawEndHandler = dojo.hitch(this, this._onDrawEndHandler);
this._onExtentChangeHandler = dojo.hitch(this, this._onExtentChangeHandler);
this._onGraphicClearHandler = dojo.hitch(this, this._onGraphicClearHandler);
this._graphicsLayer = new esri.layers.GraphicsLayer({ id: "DciMeatureGLyr" });
}


核心算法测距:
测面的核心算法:
  

测面算法也是类似,基于地理坐标系以及投影坐标系不同,有不同的计算公式来计算的;

完整的量算工具js文件下载点击打开链接
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐