Skip to content

Commit 4fc904f

Browse files
committed
Leaflet示例IGServer/投影变换检查与纠正
1 parent bd8d859 commit 4fc904f

2 files changed

Lines changed: 56 additions & 56 deletions

File tree

demo/leaflet/example/igserver/projection/projectbylayer.htm

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
22
<html xmlns="http://www.w3.org/1999/xhtml">
33
<head>
4-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
55
<title>投影转换(图层)</title>
6-
<link href="../../css/leaflet/style.css" rel="stylesheet" type="text/css" />
6+
<link href="../../css/leaflet/style.css" rel="stylesheet" type="text/css"/>
77
<script src="../../libs/zondyclient/include-leaflet-local.js"></script>
88
<script type="text/javascript">
99
//整个js文件都是严格模式下执行的
@@ -17,7 +17,7 @@
1717
var resultBaseUrl = "gdbp://MapGisLocal/OpenLayerVecterMap/sfcls/";
1818

1919
/** 地图初始化函数
20-
*/
20+
*/
2121
function init() {
2222
//地图容器
2323
map = L.map('orgMap', {
@@ -42,7 +42,7 @@
4242
}
4343

4444
/** 根据空间参照系信息对图层进行投影转换
45-
*/
45+
*/
4646
function projectByParam() {
4747
//清除之前的结果图层
4848
clearRlt();
@@ -93,23 +93,23 @@
9393
}
9494

9595
/** 分析失败回调
96-
*/
96+
*/
9797
function AnalysisError(e) {
9898
//停止进度条
9999
stopPressBar();
100100
}
101101

102102
/**回调函数,处理显示结果信息
103-
*@param(json对象)data获取结果对象
104-
*/
103+
*@param(json对象)data获取结果对象
104+
*/
105105
function projectLayerSuccess(data) {
106106
//停止进度条
107107
stopPressBar();
108-
if (!data.result.succeed) {
108+
if (!data.succeed) {
109109
alert("投影失败,请检查参数!");
110110
}
111111
else {
112-
if (data.result.results.length != 0) {
112+
if (data.results.length !== 0) {
113113
projmap = L.map('prjMap', {
114114
//参考坐标系,默认是墨卡托坐标系(EPSG3857),EPSG4326为经纬度坐标系
115115
crs: L.CRS.EPSG3857,
@@ -119,7 +119,7 @@
119119
zoom: 1
120120
});
121121
//定义图层地址
122-
var resultLayerUrl = data.result.results[0].Value;
122+
var resultLayerUrl = data.results[0].Value;
123123
//将结果图层添加到地图视图中显示
124124
var resultURL = resultBaseUrl + resultLayerUrl;
125125
resultLayer = new Zondy.Map.MapVectorLayer(encodeURIComponent(resultURL), {
@@ -137,17 +137,17 @@
137137
}
138138

139139
/** 清除之前的结果
140-
*/
140+
*/
141141
function clearRlt() {
142-
if (projmap != null) {
142+
if (projmap) {
143143
//清除投影结果
144144
projmap.remove();
145145
} else
146146
return;
147147
}
148148

149149
/** 当前日期加时间(如:2009-06-12-120000)
150-
*/
150+
*/
151151
function getCurentTime() {
152152
var now = new Date();
153153
//获取当前年份
@@ -181,33 +181,33 @@
181181
}
182182

183183
/** 停止进度条
184-
*/
184+
*/
185185
function stopPressBar() {
186186
//停止进度条
187187
document.getElementById("preview").style.display = "none";
188188
}
189189

190190
/** 开始进度条动画
191-
*/
191+
*/
192192
function startPressBar() {
193193
document.getElementById("preview").style.display = "";
194194
}
195195
</script>
196196
</head>
197197
<body onload="init()">
198-
<div id="preview" style="display: none; text-align: center; padding-top: 250px; font-weight: bold">
199-
<img src="../../img/common/39-1.gif" alt='' /><br />
200-
<br />
201-
<span>正在进行投影转换,请稍候</span>
198+
<div id="preview" style="display: none; text-align: center; padding-top: 250px; font-weight: bold">
199+
<img src="../../img/common/39-1.gif" alt=''/><br/>
200+
<br/>
201+
<span>正在进行投影转换,请稍候</span>
202+
</div>
203+
<div class="ToolLib">
204+
<input type="button" class="ButtonLib" value="根据空间参照系信息投影" onclick="projectByParam()"/>
205+
</div>
206+
<div id="leaf_map" style="width: 100%; height: 700px;">
207+
<div id="orgMap">
202208
</div>
203-
<div class="ToolLib">
204-
<input type="button" class="ButtonLib" value="根据空间参照系信息投影" onclick="projectByParam()" />
205-
</div>
206-
<div id="leaf_map" style="width: 100%; height: 700px;">
207-
<div id="orgMap">
208-
</div>
209-
<div id="prjMap">
210-
</div>
209+
<div id="prjMap">
211210
</div>
211+
</div>
212212
</body>
213213
</html>

demo/leaflet/example/igserver/projection/projectbyparam.htm

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
22
<html xmlns="http://www.w3.org/1999/xhtml">
33
<head>
4-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
55
<title>投影转换(空间参照)</title>
6-
<link href="../../css/leaflet/style.css" rel="stylesheet" type="text/css" />
6+
<link href="../../css/leaflet/style.css" rel="stylesheet" type="text/css"/>
77
<script src="../../libs/zondyclient/include-leaflet-local.js"></script>
88
<script type="text/javascript">
99
//整个js文件都是严格模式下执行的
@@ -17,7 +17,7 @@
1717
var resultBaseUrl = "gdbp://MapGisLocal/OpenLayerVecterMap/sfcls/";
1818

1919
/** 地图初始化函数
20-
*/
20+
*/
2121
function init() {
2222
//地图容器
2323
map = L.map('orgMap', {
@@ -33,7 +33,7 @@
3333
//IGServer所在ip地址
3434
ip: "develop.smaryun.com",
3535
//IGServer请求端口号
36-
port: "6163",
36+
port: "6163",
3737
//设置图层能否重复显示。true代表显示唯一,false代表显示重复。
3838
noWrap: true,
3939
//缓存名称
@@ -42,7 +42,7 @@
4242
}
4343

4444
/** 根据MapGIS空间参照系ID信息对图层进行投影转换
45-
*/
45+
*/
4646
function projectBySRID() {
4747
clearRlt();
4848
//显示进度条
@@ -67,23 +67,23 @@
6767
}
6868

6969
/** 分析失败回调
70-
*/
70+
*/
7171
function AnalysisError(e) {
7272
//停止进度条
7373
stopPressBar();
7474
}
75-
75+
7676
/**回调函数,处理显示结果信息
77-
*@param(json对象)data获取结果对象
78-
*/
77+
*@param(json对象)data获取结果对象
78+
*/
7979
function projectLayerSuccess(data) {
8080
//停止进度条
8181
stopPressBar();
82-
if (!data.result.succeed) {
82+
if (!data.succeed) {
8383
alert("投影失败,请检查参数!");
8484
}
8585
else {
86-
if (data.result.results.length != 0) {
86+
if (data.results.length !== 0) {
8787
projmap = L.map('prjMap', {
8888
//参考坐标系,默认是墨卡托坐标系(EPSG3857),EPSG4326为经纬度坐标系
8989
crs: L.CRS.EPSG3857,
@@ -93,7 +93,7 @@
9393
zoom: 1
9494
});
9595
//定义结果图层的地址
96-
var resultLayerUrl = data.result.results[0].Value;
96+
var resultLayerUrl = data.results[0].Value;
9797
//将结果图层添加到地图视图中显示
9898
var resultURL = resultBaseUrl + resultLayerUrl;
9999
resultLayer = new Zondy.Map.MapVectorLayer(encodeURIComponent(resultURL), {
@@ -111,17 +111,17 @@
111111
}
112112

113113
/** 清除之前的结果
114-
*/
114+
*/
115115
function clearRlt() {
116-
if (projmap != null) {
116+
if (projmap) {
117117
//清除投影结果
118118
projmap.remove();
119119
} else
120120
return;
121121
}
122122

123123
/** 当前日期加时间(如:2009-06-12-120000)
124-
*/
124+
*/
125125
function getCurentTime() {
126126
var now = new Date();
127127
//获取当前年份
@@ -155,33 +155,33 @@
155155
}
156156

157157
/** 停止进度条
158-
*/
158+
*/
159159
function stopPressBar() {
160160
//停止进度条
161161
document.getElementById("preview").style.display = "none";
162162
}
163163

164164
/** 开始进度条动画
165-
*/
165+
*/
166166
function startPressBar() {
167167
document.getElementById("preview").style.display = "";
168168
}
169169
</script>
170170
</head>
171171
<body onload="init()">
172-
<div id="preview" style="display: none; text-align: center; padding-top: 250px; font-weight: bold">
173-
<img src="../../img/common/39-1.gif" alt='' /><br />
174-
<br />
175-
<span>正在进行投影转换,请稍候</span>
176-
</div>
177-
<div class="ToolLib">
178-
<input type="button" class="ButtonLib" value="根据空间参照系ID信息投影" onclick="projectBySRID()" />
172+
<div id="preview" style="display: none; text-align: center; padding-top: 250px; font-weight: bold">
173+
<img src="../../img/common/39-1.gif" alt=''/><br/>
174+
<br/>
175+
<span>正在进行投影转换,请稍候</span>
176+
</div>
177+
<div class="ToolLib">
178+
<input type="button" class="ButtonLib" value="根据空间参照系ID信息投影" onclick="projectBySRID()"/>
179+
</div>
180+
<div id="leaf_map" style="width: 100%; height: 700px;">
181+
<div id="orgMap">
179182
</div>
180-
<div id="leaf_map" style="width: 100%; height: 700px;">
181-
<div id="orgMap">
182-
</div>
183-
<div id="prjMap">
184-
</div>
183+
<div id="prjMap">
185184
</div>
185+
</div>
186186
</body>
187187
</html>

0 commit comments

Comments
 (0)