Skip to content

Commit 0ae2fb1

Browse files
committed
【examples】增加机器学习示例 review by xiongjj
1 parent 1c8b58d commit 0ae2fb1

File tree

7 files changed

+236
-1
lines changed

7 files changed

+236
-1
lines changed

examples/locales/en-US/resources.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,6 +1587,8 @@ window.examplesResources = {
15871587
"btn_customTheme":"Custom theme",
15881588
"btn_switchTheme":"Switch theme",
15891589
"btn_OK":"OK",
1590+
"btn_objectdetection":"Add objectdetection result",
1591+
"btn_binaryclassification":"Add binaryclassification result",
15901592

15911593
"msg_published":"This service has already been published",
15921594
"msg_unpublish_success":"unPublish successfully",

examples/locales/zh-CN/resources.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,8 @@ window.examplesResources = {
15341534
"btn_customTheme":"自定义主题",
15351535
"btn_switchTheme":"切换主题",
15361536
"btn_OK":"确定",
1537+
"btn_objectdetection":"叠加目标检测结果",
1538+
"btn_binaryclassification":"叠加二元分类结果",
15371539

15381540
"msg_published":"已发布了该服务",
15391541
"msg_unpublish_success":"取消发布成功",

examples/mapboxgl/config.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,35 @@ var exampleConfig = {
360360
fileName: "topologyValidatorJobService"
361361
}
362362
]
363-
}
363+
},
364+
machinelearning: {
365+
name: "机器学习",
366+
name_en: "Machine Learning",
367+
content: [
368+
{
369+
name: "二元分类",
370+
name_en: "Binary Classification",
371+
version: "10.1.0",
372+
thumbnail: "machinelearning_binaryclassification.png",
373+
fileName: "machinelearning_binaryclassification"
374+
},
375+
{
376+
name: "目标检测",
377+
name_en: "Object Detection",
378+
version: "10.1.0",
379+
thumbnail: "machinelearning_objectdetection.png",
380+
fileName: "machinelearning_objectdetection"
381+
}
382+
// ,
383+
// {
384+
// name: "地物分类",
385+
// name_en: "Landcover Classification",
386+
// version: "10.1.0",
387+
// thumbnail: "machinelearning_landcoverclassification.png",
388+
// fileName: "machinelearning_landcoverclassification"
389+
// }
390+
]
391+
},
364392
}
365393
},
366394
iPortal: {
42.7 KB
Loading
43.6 KB
Loading
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<!--********************************************************************
2+
* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
3+
*********************************************************************-->
4+
<!DOCTYPE html>
5+
<html>
6+
<head>
7+
<meta charset="utf-8" />
8+
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
9+
<title data-i18n="resources.title_tiledMapLayer"></title>
10+
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
11+
<style>
12+
body {
13+
margin: 0;
14+
padding: 0;
15+
}
16+
17+
#map {
18+
position: absolute;
19+
top: 0;
20+
bottom: 0;
21+
width: 100%;
22+
}
23+
.btn {
24+
position: absolute;
25+
left: 60px;
26+
top: 10px;
27+
text-align: center;
28+
background: #fff;
29+
z-index: 1000;
30+
}
31+
</style>
32+
</head>
33+
<body>
34+
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_binaryclassification" onclick="addResultLayer()" />
35+
<div id="map"></div>
36+
<script
37+
type="text/javascript"
38+
exclude="iclient-mapboxgl"
39+
src="../../dist/mapboxgl/include-mapboxgl.js"
40+
></script>
41+
<script type="text/javascript">
42+
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
43+
var attribution =
44+
"<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
45+
" with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
46+
" Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> ";
47+
48+
var map = new mapboxgl.Map({
49+
container: 'map',
50+
style: {
51+
version: 8,
52+
sources: {
53+
'raster-tiles': {
54+
attribution: attribution,
55+
type: 'raster',
56+
tiles: [
57+
host +
58+
'/iserver/services/map-building/rest/maps/building/zxyTileImage.png?z={z}&x={x}&y={y}'
59+
],
60+
tileSize: 256
61+
}
62+
},
63+
layers: [
64+
{
65+
id: 'simple-tiles',
66+
type: 'raster',
67+
source: 'raster-tiles',
68+
minzoom: 0,
69+
maxzoom: 22
70+
}
71+
]
72+
},
73+
center: [13.594505109654733, 7.3413038418022865],
74+
zoom: 17
75+
});
76+
map.addControl(new mapboxgl.NavigationControl(), 'top-left');
77+
function addResultLayer() {
78+
if (map.getLayer('result-layer')) {
79+
map.removeLayer('result-layer');
80+
}
81+
if (map.getSource('result-layer')) {
82+
map.removeSource('result-layer');
83+
}
84+
map.addLayer({
85+
id: 'result-layer',
86+
type: 'raster',
87+
source: {
88+
attribution: attribution,
89+
type: 'raster',
90+
tiles: [
91+
host +
92+
'/iserver/services/map-building/rest/maps/result_building/zxyTileImage.png?z={z}&x={x}&y={y}&transparent=true'
93+
],
94+
tileSize: 256
95+
},
96+
minzoom: 0,
97+
maxzoom: 22
98+
});
99+
}
100+
</script>
101+
</body>
102+
</html>
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<!--********************************************************************
2+
* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
3+
*********************************************************************-->
4+
<!DOCTYPE html>
5+
<html>
6+
<head>
7+
<meta charset="utf-8" />
8+
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
9+
<title data-i18n="resources.title_tiledMapLayer"></title>
10+
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
11+
<style>
12+
body {
13+
margin: 0;
14+
padding: 0;
15+
}
16+
17+
#map {
18+
position: absolute;
19+
top: 0;
20+
bottom: 0;
21+
width: 100%;
22+
}
23+
.btn {
24+
position: absolute;
25+
left: 60px;
26+
top: 10px;
27+
text-align: center;
28+
background: #fff;
29+
z-index: 1000;
30+
}
31+
</style>
32+
</head>
33+
<body>
34+
<input type="button" class="btn btn-default" data-i18n="[value]resources.btn_objectdetection" onclick="addResultLayer()" />
35+
<div id="map"></div>
36+
<script
37+
type="text/javascript"
38+
exclude="iclient-mapboxgl"
39+
src="../../dist/mapboxgl/include-mapboxgl.js"
40+
></script>
41+
<script type="text/javascript">
42+
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
43+
var attribution =
44+
"<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
45+
" with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
46+
" Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> ";
47+
48+
var map = new mapboxgl.Map({
49+
container: 'map',
50+
style: {
51+
version: 8,
52+
sources: {
53+
'raster-tiles': {
54+
attribution: attribution,
55+
type: 'raster',
56+
tiles: [
57+
host + '/iserver/services/map-plane/rest/maps/plane/zxyTileImage.png?z={z}&x={x}&y={y}'
58+
],
59+
tileSize: 256
60+
}
61+
},
62+
layers: [
63+
{
64+
id: 'simple-tiles',
65+
type: 'raster',
66+
source: 'raster-tiles',
67+
minzoom: 0,
68+
maxzoom: 22
69+
}
70+
]
71+
},
72+
center: [-87.89799410302197, 41.97732379151233], // starting position
73+
zoom: 15.8 // starting zoom
74+
});
75+
map.addControl(new mapboxgl.NavigationControl(), 'top-left');
76+
function addResultLayer() {
77+
if (map.getLayer('result-layer')) {
78+
map.removeLayer('result-layer');
79+
}
80+
if (map.getSource('result-layer')) {
81+
map.removeSource('result-layer');
82+
}
83+
map.addLayer({
84+
id: 'result-layer',
85+
type: 'raster',
86+
source: {
87+
attribution: attribution,
88+
type: 'raster',
89+
tiles: [
90+
host +
91+
'/iserver/services/map-plane/rest/maps/result_plane/zxyTileImage.png?z={z}&x={x}&y={y}&transparent=true'
92+
],
93+
tileSize: 256
94+
},
95+
minzoom: 0,
96+
maxzoom: 22
97+
});
98+
}
99+
</script>
100+
</body>
101+
</html>

0 commit comments

Comments
 (0)