123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <!--********************************************************************
- * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
- *********************************************************************-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title data-i18n="resources.title_mathExpression"></title>
- <script type="text/javascript" src="../js/include-web.js"></script>
- </head>
- <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
- <div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
- <script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
- <script type="text/javascript">
- var host = window.isLocal ? window.server : "https://iserver.supermap.io";
- var map, mathExpressionAnalysisService, mathExpressionAnalysisParameters, mathExpressionAnalysisResult,
- themeService, themeGridRange, themeParameters, themeLayer,
- baseUrl = host + "/iserver/services/map-jingjin/rest/maps/京津地区地图",
- serviceUrl = host + "/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst";
- map = L.map('map', {
- crs: L.CRS.EPSG4326,
- center: [40.05, 116.85],
- maxZoom: 18,
- zoom: 6
- });
- L.supermap.tiledMapLayer(baseUrl, {noWrap: true}).addTo(map).once("load ", function () {
- mathExpressionAnalysisProcess();
- });
- function mathExpressionAnalysisProcess() {
- //创建栅格代数运算服务实例
- mathExpressionAnalysisService = L.supermap.spatialAnalystService(serviceUrl);
- //创建栅格代数运算参数实例
- mathExpressionAnalysisParameters = new SuperMap.MathExpressionAnalysisParameters({
- //指定数据集,必设
- dataset: "JingjinTerrain@Jingjin",
- //要执行的栅格运算代数表达式,必设
- expression: "[Jingjin.JingjinTerrain] + 600",
- //存储结果数据集的数据源,必设
- targetDatasource: "Jingjin",
- //结果数据集名称,必设
- resultGridName: "MathExpressionAnalysis_Result",
- deleteExistResultDataset: true
- /*//指定数据集中参与栅格代数运算的区域
- extractRegion: L.polygon([
- [38, 116],
- [38, 117],
- [42, 117],
- [42, 116]
- ])*/
- });
- //向iServer发起栅格代数运算请求
- mathExpressionAnalysisService.mathExpressionAnalysis(mathExpressionAnalysisParameters, function (serviceResult) {
- mathExpressionAnalysisResult = serviceResult.result;
- //用栅格专题图展示分析结果
- showAnalysisResult_ThemeGridRange();
- });
- }
- function showAnalysisResult_ThemeGridRange() {
- themeService = L.supermap.themeService(baseUrl);
- var themeGridRangeIteme1 = new SuperMap.ThemeGridRangeItem({
- start: 0,
- end: 650,
- color: new SuperMap.ServerColor(40, 140, 40)
- }),
- themeGridRangeIteme2 = new SuperMap.ThemeGridRangeItem({
- start: 650,
- end: 750,
- color: new SuperMap.ServerColor(170, 198, 40)
- }),
- themeGridRangeIteme3 = new SuperMap.ThemeGridRangeItem({
- start: 750,
- end: 900,
- color: new SuperMap.ServerColor(191, 191, 0)
- }),
- themeGridRangeIteme4 = new SuperMap.ThemeGridRangeItem({
- start: 900,
- end: 1350,
- color: new SuperMap.ServerColor(191, 95, 0)
- }),
- themeGridRangeIteme5 = new SuperMap.ThemeGridRangeItem({
- start: 1350,
- end: 3600,
- color: new SuperMap.ServerColor(127, 0, 0)
- });
- themeGridRange = new SuperMap.ThemeGridRange({
- reverseColor: false,
- rangeMode: SuperMap.RangeMode.EQUALINTERVAL,
- //栅格分段专题图子项数组
- items: [themeGridRangeIteme1,
- themeGridRangeIteme2,
- themeGridRangeIteme3,
- themeGridRangeIteme4,
- themeGridRangeIteme5
- ]
- });
- themeParameters = new SuperMap.ThemeParameters({
- //制作专题图的数据集
- datasetNames: [mathExpressionAnalysisResult.dataset.split('@')[0]],
- dataSourceNames: ["Jingjin"],
- joinItems: null,
- themes: [themeGridRange]
- });
- themeService.getThemeInfo(themeParameters, function (serviceResult1) {
- var result = serviceResult1.result;
- if (result && result.newResourceID) {
- themeLayer = L.supermap.tiledMapLayer(baseUrl, {
- noWrap: true,
- cacheEnabled: false,
- transparent: true,
- layersID: result.newResourceID,
- opacity: 0.8
- }).addTo(map);
- }
- });
- }
- </script>
- </body>
- </html>
|