Skip to content

Commit 9b01336

Browse files
【fix】 fix mapbox多坐标系例子 review by songym
1 parent 616e0b9 commit 9b01336

17 files changed

+180
-124
lines changed

examples/leaflet/widgets_Search.html

Lines changed: 61 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
*********************************************************************-->
44
<!DOCTYPE html>
55
<html lang="en">
6+
67
<head>
78
<meta charset="UTF-8">
89
<title>POI</title>
910
<script type="text/javascript" src="../js/include-web.js"></script>
10-
<script type="text/javascript" include="iclient9-leaflet-css"
11-
src="../../dist/leaflet/include-leaflet.js"></script>
11+
<script type="text/javascript" include="iclient9-leaflet-css" src="../../dist/leaflet/include-leaflet.js"></script>
1212
<style>
1313
/*修改leaflet默认弹框样式*/
14-
.leaflet-popup, .leaflet-popup-content-wrapper {
14+
15+
.leaflet-popup,
16+
.leaflet-popup-content-wrapper {
1517
padding: 0;
1618
}
1719

@@ -20,63 +22,66 @@
2022
}
2123
</style>
2224
</head>
25+
2326
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
24-
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
25-
<script>
26-
var map = L.map('map', {
27-
center: [25, 40],
28-
zoom: 3,
29-
});
30-
var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
31-
var url = host + '/iserver/services/map-china400/rest/maps/China';
32-
var sqlurl = host + "/iserver/services/map-world/rest/maps/World";
27+
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
28+
<script>
29+
var map = L.map('map', {
30+
center: [25, 40],
31+
zoom: 3,
32+
});
33+
var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
34+
var url = host + '/iserver/services/map-china400/rest/maps/China';
35+
var sqlurl = host + "/iserver/services/map-world/rest/maps/World";
3336

34-
L.supermap.tiledMapLayer(url).addTo(map);
35-
//添加微件:
36-
var poiSearch = L.supermap.widgets.search({
37-
//设置结果图层样式:
38-
/*style: (feature, latLng) => {
39-
if (latLng /!*&& feature instanceof L.latLng || feature.geometry.type.toLowerCase() === "point"*!/) {
40-
return L.circleMarker(latLng, {
41-
fillColor: 'red',
42-
weight: 1,
43-
opacity: 1,
44-
color: 'red',
45-
fillOpacity: 0.6
46-
});
47-
}
48-
}*/
49-
});
50-
poiSearch.addTo(map);
37+
L.supermap.tiledMapLayer(url).addTo(map);
38+
//添加微件:
39+
var poiSearch = L.supermap.widgets.search({
40+
isGeoCoding: !window.isLocal
41+
//设置结果图层样式:
42+
/*style: (feature, latLng) => {
43+
if (latLng /!*&& feature instanceof L.latLng || feature.geometry.type.toLowerCase() === "point"*!/) {
44+
return L.circleMarker(latLng, {
45+
fillColor: 'red',
46+
weight: 1,
47+
opacity: 1,
48+
color: 'red',
49+
fillOpacity: 0.6
50+
});
51+
}
52+
}*/
53+
});
54+
poiSearch.addTo(map);
5155

52-
//添加示例图层:
53-
query();
56+
//添加示例图层:
57+
query();
5458

55-
function query() {
56-
//查询数据构建示例图层:
57-
var polygon = L.polygon([[90, 180], [90, -180], [-90, -180], [-90, 180], [90, 180]]);
58-
var param = new SuperMap.QueryByBoundsParameters({
59-
queryParams: {name: "Capitals@World.1"},
60-
bounds: polygon.getBounds()
61-
});
62-
L.supermap
63-
.queryService(sqlurl)
64-
.queryByBounds(param, function (serviceResult) {
65-
var result = serviceResult.result;
66-
var resultLayer = L.geoJSON(result.recordsets[0].features, {
67-
pointToLayer: (geoJsonPoint, latlng) => {
68-
return L.circleMarker(latlng, {
69-
fillColor: 'blue',
70-
weight: 1,
71-
opacity: 1,
72-
color: 'blue',
73-
fillOpacity: 0.6
74-
});
75-
},
76-
}).addTo(map);
77-
poiSearch.addSearchLayer([L.supermap.widgets.geoJSONLayerWithName("首都", resultLayer)]);
59+
function query() {
60+
//查询数据构建示例图层:
61+
var polygon = L.polygon([[90, 180], [90, -180], [-90, -180], [-90, 180], [90, 180]]);
62+
var param = new SuperMap.QueryByBoundsParameters({
63+
queryParams: { name: "Capitals@World.1" },
64+
bounds: polygon.getBounds()
7865
});
79-
}
80-
</script>
66+
L.supermap
67+
.queryService(sqlurl)
68+
.queryByBounds(param, function (serviceResult) {
69+
var result = serviceResult.result;
70+
var resultLayer = L.geoJSON(result.recordsets[0].features, {
71+
pointToLayer: (geoJsonPoint, latlng) => {
72+
return L.circleMarker(latlng, {
73+
fillColor: 'blue',
74+
weight: 1,
75+
opacity: 1,
76+
color: 'blue',
77+
fillOpacity: 0.6
78+
});
79+
},
80+
}).addTo(map);
81+
poiSearch.addSearchLayer([L.supermap.widgets.geoJSONLayerWithName("首都", resultLayer)]);
82+
});
83+
}
84+
</script>
8185
</body>
86+
8287
</html>

examples/locales/en-US/resources.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,8 @@ window.examplesResources = {
332332
"title_measureArea": "Area Measurement Service",
333333
"title_measureDistance": "Distance Measurement Service",
334334
"title_tiledMapLayer": "3857 Coordinate System",
335-
"title_tiledMapLayer_4326": "4326 Coordinate System",
335+
"title_tiledMapLayer_4326": "4326Map",
336+
"title_tiledMapLayer_4326WGS84": "Map WGS84",
336337
"title_fieldService": "SuperMap Field Service",
337338
"title_fieldStatistics": "Dataset Field Statistics Service",
338339
"title_getGridCellInfos": "Data Grid Cell Query",
@@ -342,6 +343,7 @@ window.examplesResources = {
342343
"title_thiessenAnalystDataset": "Dataset Thiessen Analysis",
343344
"title_thiessenAnalystGeometry": "Geometry Thiessen Analysis",
344345
"title_drawControl": "Drawing Control",
346+
"title_drawControlWGS84": "Drawing Control WGS84",
345347
"title_fullscreenControl": "Full Screen Control",
346348
"title_geolocateControl": "Location Control",
347349
"title_navigationControl": "Navigation Control",
@@ -351,10 +353,12 @@ window.examplesResources = {
351353
"title_ChangchunPublicTransportNetwork": "Changchun Public Transport Network",
352354
"title_effectScatter": "Urban Air Quality Map",
353355
"title_geoline": "Simulated Migration Chart",
356+
"title_geolineWGS84": "Simulated Migration Chart WGS84",
354357
"title_linesBus": "line",
355358
"title_linesEffect": "line effect",
356359
"title_linesAirline": "Airplane Route Map of the World",
357360
"title_scatterWeibo": "Scatter of Weibo Users",
361+
"title_scatterWeiboWGS84": "Scatter of Weibo Users WGS84",
358362
"title_colorfulCity": "Colorful Buildings",
359363
"title_flightPath": "Flight Path Map",
360364
"title_GlobalWind": "Global Wind Visualization Map",
@@ -378,6 +382,7 @@ window.examplesResources = {
378382
"title_mapvForceEdge": "MapV Force Edge Bundling",
379383
"title_mapvPolylineIntensity": "MapV Polyline Intensity Map",
380384
"title_mapvCsvcar": "MapV Csv Car",
385+
"title_mapvCsvcarWGS84": "MapV Csv Car WGS84",
381386
"title_mapvBeijingVillage": "MapV Beijing Village Map",
382387
"title_layerService": "SuperMap Layer Service",
383388
"title_tiledMapLayerNonEarth": "Planar coordinate base map of SuperMap REST",
@@ -388,12 +393,14 @@ window.examplesResources = {
388393
"title_findTSPPathsService": "Multi-traveler Analysis - Quality Inspection",
389394
"title_graphicLayer": "High efficiency point layer - points of 180K NY taxis",
390395
"title_mb_graphicLayer": "High efficiency point layer",
396+
"title_mb_graphicLayerWGS84": "High efficiency point layer WGS84",
391397
"title_graphicLayer_webgl": "High efficiency point layer-webgl",
392398
"title_graphicLayerClovers": "High efficiency point layer - clover",
393399
"title_graphicLayerTaxi": "High efficiency point layer - picture drawing of 180K NY taxis",
394400
"title_heatMap": "Heat map",
395401
"title_heatMapNY": "Heat map of New York Taxis",
396402
"title_markerCluster": "Marker Cluster",
403+
"title_markerClusterWGS84": "Marker Cluster WGS84",
397404
"title_pulse": "Flashing Points",
398405
"title_geometryBatchAnalystService": "Spatial Batch Analyst of Geometry",
399406
"title_geometryOverlayBatchAnalystService": "Batch Analyst of Overlay",
@@ -458,6 +465,7 @@ window.examplesResources = {
458465
"title_iPortalQueryMaps1": "Examples of iPortal QueryMaps ",
459466
"title_iServerSecurity": "Examples of iServer Security Certification",
460467
"title_mapVLayerPolygon": "Village of Beijing",
468+
"title_mapVLayerPolygonWGS84": "Polygon WGS84",
461469
"title_planesMonitor": "Flight Monitoring",
462470
"title_vectorTileLayerBoundary": "Boundary Style of SuperMap REST Vector Layer",
463471
"title_vectorTileLayerDarkBlue": "Dark Blue Style of SuperMap REST Vector Layer",
@@ -475,11 +483,13 @@ window.examplesResources = {
475483
"title_l_echartsEarthquake1": "2008 to 2017 years of earthquake statistics",
476484
"title_echartsLinesMillions_bjRoads": "Use lines to draw 1.3 millions Beijing's roads",
477485
"title_echartsLinesMillions_railways": "Use lines to draw 4 millions Chinese railways",
486+
"title_echartsLinesMillions_railwaysWGS84": "Use lines to draw 4 millions Chinese railways WGS84",
478487
"title_echartsLinesMillions_waterSystem": "Use lines to draw 14 millions Chinese water system",
479488
"title_echartsLinesMillions_roads": "Use lines to draw 25 millions Chinese roads",
480489
"title_echartsLinesMillions_nyTaxi": "Use scatter to draw 1.4 millions New York Taxi Points",
481490
"title_mb_deckglLayer_arcLayer": "arc-layer",
482491
"title_mb_deckglLayer_pathLayer": "path-layer",
492+
"title_mb_deckglLayer_pathLayerWGS84": "path-layer WGS84",
483493
"title_mb_deckglLayer_polygonLayer": "polygon-layer",
484494
"title_mb_deckglLayer_hexagonLayer": "hexagon-layer",
485495
"title_mb_deckglLayer_nyBuilding": "New York Construction",
@@ -496,7 +506,9 @@ window.examplesResources = {
496506
"title_spatialAnalysis": 'Client Computation',
497507
"title_distributeAnalysis": 'Distribute Analysis',
498508
"title_dataServiceQuery": 'Data service query',
499-
"title_ChinaEarthquakeHeat": 'China Earthquake heatmap',
509+
"title_ChinaEarthquakeHeat": 'China Earthquake',
510+
"title_ChinaEarthquakeHeatWGS84": 'China Earthquake WGS84',
511+
"title_ChinaEarthquakeHeatClient": 'China Earthquake(Classic) WGS84',
500512

501513

502514
"text_code": "Forward Match",

examples/locales/zh-CN/resources.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ window.examplesResources = {
276276
"title_measureDistance": "距离测量",
277277
"title_tiledMapLayer": "3857底图",
278278
"title_tiledMapLayer_4326": "4326底图",
279+
"title_tiledMapLayer_4326WGS84": "地图_WGS84",
279280
"title_fieldService": "SuperMap 字段信息",
280281
"title_fieldStatistics": "字段查询统计",
281282
"title_getGridCellInfos": "栅格查询",
@@ -285,6 +286,7 @@ window.examplesResources = {
285286
"title_thiessenAnalystDataset": "数据集泰森多边形",
286287
"title_thiessenAnalystGeometry": "几何泰森多边形",
287288
"title_drawControl": "绘制控件",
289+
"title_drawControlWGS84": "绘制控件_WGS84",
288290
"title_fullscreenControl": "全屏控件",
289291
"title_geolocateControl": "定位控件",
290292
"title_navigationControl": "导航控件",
@@ -294,10 +296,12 @@ window.examplesResources = {
294296
"title_ChangchunPublicTransportNetwork": "长春公交路径图",
295297
"title_effectScatter": "全国主要城市空气质量图",
296298
"title_geoline": "迁徙图",
299+
"title_geolineWGS84": "迁徙图_WGS84",
297300
"title_linesBus": "线路图",
298301
"title_linesEffect": "线特效",
299302
"title_linesAirline": "世界飞机航线图",
300303
"title_scatterWeibo": "微博签到图",
304+
"title_scatterWeiboWGS84": "微博签到图_WGS84",
301305
"title_colorfulCity": "五彩城市建筑",
302306
"title_flightPath": "飞行路径图",
303307
"title_GlobalWind": "全球风能可视化",
@@ -321,6 +325,7 @@ window.examplesResources = {
321325
"title_mapvForceEdge": "强边界图",
322326
"title_mapvPolylineIntensity": "强度线",
323327
"title_mapvCsvcar": "通勤图",
328+
"title_mapvCsvcarWGS84": "通勤图",
324329
"title_mapvBeijingVillage": "北京村庄分布图",
325330
"title_layerService": "SuperMap 图层信息",
326331
"title_tiledMapLayerNonEarth": "SuperMap REST 平面坐标系底图",
@@ -331,12 +336,14 @@ window.examplesResources = {
331336
"title_findTSPPathsService": "网络分析服务-旅行商分析(质检巡查)",
332337
"title_graphicLayer": "高效率点图层-18万纽约出租车点",
333338
"title_mb_graphicLayer": "纽约出租车145万上车点",
339+
"title_mb_graphicLayerWGS84": "纽约出租车145万上车点_WGS84",
334340
"title_graphicLayer_webgl": "纽约145万出租车-webgl",
335341
"title_graphicLayerClovers": "高效率点图层-三叶草",
336342
"title_graphicLayerTaxi": "纽约18万出租车-符号绘制",
337343
"title_heatMap": "热力图",
338344
"title_heatMapNY": "纽约出租车上车点热力图",
339345
"title_markerCluster": "点聚合",
346+
"title_markerClusterWGS84": "点聚合_WGS84",
340347
"title_pulse": "闪烁点",
341348
"title_geometryBatchAnalystService": "几何对象批量空间分析",
342349
"title_geometryOverlayBatchAnalystService": "几何对象批量叠加分析",
@@ -400,7 +407,8 @@ window.examplesResources = {
400407
"title_nodeManagementUseExample": "iManager 节点管理使用示例",
401408
"title_iPortalQueryMaps1": "iPortal QueryMaps使用示例",
402409
"title_iServerSecurity": "iServer 安全认证示例",
403-
"title_mapVLayerPolygon": "MapV面",
410+
"title_mapVLayerPolygon": "面",
411+
"title_mapVLayerPolygonWGS84": "面_WGS84",
404412
"title_planesMonitor": "航班监控",
405413
"title_vectorTileLayerBoundary": "SuperMap REST 强边界风格矢量底图",
406414
"title_vectorTileLayerDarkBlue": "SuperMap REST 深夜蓝黑风格矢量底图",
@@ -419,11 +427,13 @@ window.examplesResources = {
419427
"title_l_echartsEarthquake1": "2008到2017年地震情况统计",
420428
"title_echartsLinesMillions_bjRoads": "北京道路网络图(130万点数据绘制)",
421429
"title_echartsLinesMillions_railways": "全国铁路网络图(400万点数据绘制)",
430+
"title_echartsLinesMillions_railwaysWGS84": "全国铁路网络图(400万点数据绘制)_WGS84",
422431
"title_echartsLinesMillions_waterSystem": "全国水系图(1400万点数据绘制)",
423432
"title_echartsLinesMillions_roads": "全国道路网络图(2500万点数据绘制)",
424433
"title_echartsLinesMillions_nyTaxi": "纽约出租车上车点分布图(140万点数据绘制)",
425434
"title_mb_deckglLayer_arcLayer": "曲线图层",
426-
"title_mb_deckglLayer_pathLayer": "线路图层",
435+
"title_mb_deckglLayer_pathLayer": "路径图",
436+
"title_mb_deckglLayer_pathLayerWGS84": "路径图_WGS84",
427437
"title_mb_deckglLayer_polygonLayer": "多边形图层",
428438
"title_mb_deckglLayer_hexagonLayer": "蜂巢图层",
429439
"title_mb_deckglLayer_nyBuilding": "纽约城市建筑",
@@ -444,7 +454,9 @@ window.examplesResources = {
444454
"title_flyBird":"飞鸟模型",
445455
"title_buildings":"建筑模型",
446456
"title_facility":"设施点(mtl+obj格式)",
447-
"title_ChinaEarthquakeHeat": '中国地震数据热力图',
457+
"title_ChinaEarthquakeHeat": '中国地震数据',
458+
"title_ChinaEarthquakeHeatWGS84": '中国地震数据_WGS84',
459+
"title_ChinaEarthquakeHeatClient": '中国地震数据(Classic)_WGS84',
448460

449461
"text_code": "正向匹配",
450462
"text_decode": "反向匹配",

examples/mapboxgl/01_tiledMapLayer_4326.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<head>
77
<meta charset='utf-8' />
88
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
9-
<title data-i18n="resources.title_tiledMapLayer_4326"></title>
9+
<title data-i18n="resources.title_tiledMapLayer_4326WGS84"></title>
1010
<script type="text/javascript" src="../js/include-web.js"></script>
1111
<script type="text/javascript" include="mapbox-gl-enhance" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
1212
<style>
@@ -27,6 +27,7 @@
2727
<body>
2828
<div id='map'></div>
2929
<script type="text/javascript">
30+
var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
3031
var map = new mapboxgl.Map({
3132
container: 'map', // container id
3233
style: {
@@ -49,7 +50,7 @@
4950

5051
//推荐; iserver tileimage资源;扩展支持
5152
//参数列表:地图服务地址(到地图名)必填 ; rasterSource为"iserver";必填; transparent:可选,默认为true
52-
"tiles": ['http://iclsvr.supermap.io/iserver/services/map-world/rest/maps/World'],
53+
"tiles": [host + '/iserver/services/map-world/rest/maps/World'],
5354
"rasterSource":"iserver"
5455

5556

@@ -76,7 +77,7 @@
7677
datasetNames: ["World:Countries"]
7778
});
7879
var service = new mapboxgl.supermap.FeatureService(
79-
"http://iclsvr.supermap.io/iserver/services/data-world/rest/data");
80+
host + "/iserver/services/data-world/rest/data");
8081
service.getFeaturesByIDs(idsParam, function (serviceResult) {
8182
map.addSource("queryDatas", {
8283
"type": "geojson",

0 commit comments

Comments
 (0)