详细解读arcgis投影测试

简介: 详细解读arcgis投影测试

<!DOCTYPE html

[/span>html

[/span>head

[/span>meta charset="utf-8"

[/span>title

[/span>link rel="stylesheet" href="" />

[/span>link rel="stylesheet" href="" />

[/span>style

html, body, #main {

padding: 0;

margin: 0;

Width</span>: 100%;

Height</span>: 100%;

}

[/span>script src=""

[/span>script

var map, gsvc;

require(【"dojo/parser", "esri/geometry/Extent", "esri/map", "esri/layers/ArcGISTiledMapServiceLayer",

"esri/SpatialReference", "esri/tasks/GeometryService", "esri/geometry/webMercatorUtils", "esri/geometry/Point",

"dijit/layout/BorderContainer", "dijit/layout/ContentPane",

"dojo/domReady!"】,

function (parser, Extent, Map, ArcGISTiledMapServiceLayer, SpatialReference, GeometryService, webMercatorUtils, Point) {

parser.parse();

map = new esri.Map("mapDiv");

var layer = new ArcGISTiledMapServiceLayer("");

map.addLayer(layer);

map.setExtent(new Extent(-144.13, 7.98, -52.76, 68.89, new SpatialReference({ wkid: 4326 })));

gsvc = new GeometryService("");

map.on("click", projectToWebMercator);

function projectToWebMercator(evt) {

map.graphics.clear();

var point = evt.mapPoint;

var outSR = new SpatialReference({ wkid: 102113 }//代码效果参考:http://www.ezhiqi.com/zx/art_2366.html );

// 利用webMercatorUtils模块转换坐标

var wm = webMercatorUtils.geographicToWebMercator(point);

// 利用我们自己的计算方法转换坐标

var we = toWebMercator(point);

gsvc.project(【point】, outSR, function (projectedPoints) {

pt = projectedPoints【0】;

var desc1 = "通过服务得到的坐标:

" + pt.x.toFixed(3) + ";" + pt.y.toFixed(3);

var desc2 = "功能函数计算的坐标:

" + wm.x.toFixed(3) + ";" + wm.y.toFixed(3);

var desc3 = "自己函数计算的坐标:

" + we.x.toFixed(3) + ";" + we.y.toFixed(3);

document.getElementById("spatialReference").innerHTML = desc1 + "

" + desc2 + "

" + desc3;

});

}

function toWebMercator(pt) {

var num = pt.x 0.017453292519943295;

var x = 6378137.0 num;

var a = pt.y 0.017453292519943295;

var y = 3189068.5 Math.log((1.0 + Math.sin(a)) / (1.0 - Math.sin(a)));

return new Point({ "x": x, "y": y, "spatialReference": { "wkid": 102113 }//代码效果参考:http://www.ezhiqi.com/bx/art_6119.html }//代码效果参考:http://www.ezhiqi.com/zx/art_5298.html );

}

});

[/span>body class="soria"

[/span>div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'" id="main"

[/span>div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'" style="height: 60px;"

[/span>h3

[/span>div id="mapDiv" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"

[/span>div id="spatialReference" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'right', splitter:true" style="width:200px; border:1px solid #000;"

</<span style="col

相关文章
|
6月前
|
Serverless
详细解读arcgis投影测试
详细解读arcgis投影测试
18 0
|
定位技术
ArcGIS:如何对栅格图像进行地理配准和定义投影?
ArcGIS:如何对栅格图像进行地理配准和定义投影?
1746 0
|
定位技术
ArcGIS投影:地理坐标系转为投影坐标系
本文介绍在ArcMap软件中,对矢量图层或栅格图层进行投影(即将地理坐标系转为投影坐标系)的原理与操作方法~
1180 1
ArcGIS投影:地理坐标系转为投影坐标系
|
7月前
|
定位技术 Python
ArcGIS中ArcMap通过模型构建器ModelBuilder导出地理与投影坐标系转换Python代码的方法
ArcGIS中ArcMap通过模型构建器ModelBuilder导出地理与投影坐标系转换Python代码的方法
123 2
|
7月前
ArcGIS中ArcMap为不含坐标系的图层添加地理坐标系或投影坐标系
ArcGIS中ArcMap为不含坐标系的图层添加地理坐标系或投影坐标系
158 1
|
7月前
|
定位技术
ArcGIS矢量图层投影与地理坐标系转为投影坐标系——ArcMap
ArcGIS矢量图层投影与地理坐标系转为投影坐标系——ArcMap
144 1
|
数据可视化 C++
高斯正反算—投影坐标转大地坐标、大地坐标转投影坐标(附有完整代码及测试结果)
高斯正反算—投影坐标转大地坐标、大地坐标转投影坐标(附有完整代码及测试结果)
|
测试技术 API 定位技术
ArcGIS API for Silverlight 调用GP服务准备---GP模型建立、发布、测试
原文:ArcGIS API for Silverlight 调用GP服务准备---GP模型建立、发布、测试                                                                                               ...
1403 0