123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- <!--********************************************************************
- * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
- *********************************************************************-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title data-i18n="resources.title_interpolationAnalystServiceKriging"></title>
- <script type="text/javascript" src="../js/include-web.js"></script>
- <script type="text/javascript" src="../../dist/ol/include-ol.js"></script>
- </head>
- <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%; position: absolute;top: 0;">
- <div id="map" style="width: 100%;height:100%"></div>
- <script type="text/javascript">
- var map, options, interpolationAnalystResult,
- baseUrl = (window.isLocal ? window.server : "https://iserver.supermap.io")+"/iserver/services/map-temperature/rest/maps/全国温度变化图",
- serviceUrl = (window.isLocal ? window.server : "https://iserver.supermap.io")+"/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst";
- var extent = [-2640403.63, 1873792.1, 3247669.39, 5921501.4];
- var projection = new ol.proj.Projection({
- code:'',
- extent: extent,
- units: 'm'
- });
- new ol.supermap.MapService(baseUrl).getMapInfo(function (serviceResult) {
- var mapJSONObj = serviceResult.result;
- map = new ol.Map({
- target: 'map',
- controls: ol.control.defaults({attributionOptions: {collapsed: false}})
- .extend([new ol.supermap.control.Logo()]),
- view: new ol.View({
- center: [531762, 3580330],
- zoom: 1,
- projection: projection,
- multiWorld: true
- })
- });
- options = ol.source.TileSuperMapRest.optionsFromMapJSON(baseUrl, mapJSONObj);
- options.layersID = "[0,1,2]";
- var layer = new ol.layer.Tile({
- source: new ol.source.TileSuperMapRest(options)
- });
- map.addLayer(layer);
- interpolationAnalystProcess();
- });
- function interpolationAnalystProcess() {
- //创建点密度插值分析参数实例
- var interpolationAnalystParameters = new SuperMap.InterpolationKrigingAnalystParameters({
- //用于做插值分析的数据源中数据集的名称
- dataset: "SamplesP@Interpolation",
- //插值分析结果数据集的名称
- outputDatasetName: "Kriging_Result",
- //插值分析结果数据源的名称
- outputDatasourceName: "Interpolation",
- //结果栅格数据集存储的像素格式
- pixelFormat: SuperMap.PixelFormat.DOUBLE,
- // 属性过滤条件
- filterQueryParameter: {
- attributeFilter: ""
- },
- //存储用于进行插值分析的字段名称
- zValueFieldName: "AVG_TMP",
- searchRadius: "0",
- //普通克吕金插值的类型
- type: "KRIGING",
- searchMode: "KDTREE_FIXED_COUNT",
- bounds: [-2640403.63, 1873792.1, 3247669.39, 5921501.4]
- });
- new ol.supermap.SpatialAnalystService(serviceUrl).interpolationAnalysis(interpolationAnalystParameters, function (serviceResult) {
- interpolationAnalystResult = serviceResult.result;
- //用栅格专题图展示分析结果
- showAnalysisResult_ThemeGridRange();
- });
- //构造栅格专题图
- function showAnalysisResult_ThemeGridRange() {
- var color1 = new SuperMap.ServerColor(170, 240, 233),
- color2 = new SuperMap.ServerColor(176, 244, 188),
- color3 = new SuperMap.ServerColor(218, 251, 178),
- color4 = new SuperMap.ServerColor(220, 236, 145),
- color5 = new SuperMap.ServerColor(96, 198, 66),
- color6 = new SuperMap.ServerColor(20, 142, 53),
- color7 = new SuperMap.ServerColor(85, 144, 55),
- color8 = new SuperMap.ServerColor(171, 168, 38),
- color9 = new SuperMap.ServerColor(235, 165, 9),
- color10 = new SuperMap.ServerColor(203, 89, 2),
- color11 = new SuperMap.ServerColor(157, 25, 1),
- color12 = new SuperMap.ServerColor(118, 15, 3),
- color13 = new SuperMap.ServerColor(112, 32, 7),
- color14 = new SuperMap.ServerColor(106, 45, 12),
- color15 = new SuperMap.ServerColor(129, 80, 50),
- color16 = new SuperMap.ServerColor(160, 154, 146),
- color17 = new SuperMap.ServerColor(107, 47, 14),
- color18 = new SuperMap.ServerColor(125, 75, 44),
- color19 = new SuperMap.ServerColor(146, 110, 88),
- color20 = new SuperMap.ServerColor(166, 153, 146);
- var themeGridRangeIteme1 = new SuperMap.ThemeGridRangeItem({
- start: -5,
- end: -3.4,
- color: color1
- }),
- themeGridRangeIteme2 = new SuperMap.ThemeGridRangeItem({
- start: -3.4,
- end: -1.8,
- color: color2
- }),
- themeGridRangeIteme3 = new SuperMap.ThemeGridRangeItem({
- start: -1.8,
- end: -0.2,
- color: color3
- }),
- themeGridRangeIteme4 = new SuperMap.ThemeGridRangeItem({
- start: -0.2,
- end: 1.4,
- color: color4
- }),
- themeGridRangeIteme5 = new SuperMap.ThemeGridRangeItem({
- start: 1.4,
- end: 3,
- color: color5
- }),
- themeGridRangeIteme6 = new SuperMap.ThemeGridRangeItem({
- start: 3,
- end: 4.6,
- color: color6
- }),
- themeGridRangeIteme7 = new SuperMap.ThemeGridRangeItem({
- start: 4.6,
- end: 6.2,
- color: color7
- }),
- themeGridRangeIteme8 = new SuperMap.ThemeGridRangeItem({
- start: 6.2,
- end: 7.8,
- color: color8
- }),
- themeGridRangeIteme9 = new SuperMap.ThemeGridRangeItem({
- start: 7.8,
- end: 9.4,
- color: color9
- }),
- themeGridRangeIteme10 = new SuperMap.ThemeGridRangeItem({
- start: 9.4,
- end: 11,
- color: color10
- }),
- themeGridRangeIteme11 = new SuperMap.ThemeGridRangeItem({
- start: 11,
- end: 12.6,
- color: color11
- }),
- themeGridRangeIteme12 = new SuperMap.ThemeGridRangeItem({
- start: 12.6,
- end: 14.2,
- color: color12
- }),
- themeGridRangeIteme13 = new SuperMap.ThemeGridRangeItem({
- start: 14.2,
- end: 15.8,
- color: color13
- }),
- themeGridRangeIteme14 = new SuperMap.ThemeGridRangeItem({
- start: 15.8,
- end: 17.4,
- color: color14
- }),
- themeGridRangeIteme15 = new SuperMap.ThemeGridRangeItem({
- start: 17.4,
- end: 19,
- color: color15
- }),
- themeGridRangeIteme16 = new SuperMap.ThemeGridRangeItem({
- start: 19,
- end: 20.6,
- color: color16
- }),
- themeGridRangeIteme17 = new SuperMap.ThemeGridRangeItem({
- start: 20.6,
- end: 22.2,
- color: color17
- }),
- themeGridRangeIteme18 = new SuperMap.ThemeGridRangeItem({
- start: 22.2,
- end: 23.8,
- color: color18
- }),
- themeGridRangeIteme19 = new SuperMap.ThemeGridRangeItem({
- start: 23.8,
- end: 25.4,
- color: color19
- }),
- themeGridRangeIteme20 = new SuperMap.ThemeGridRangeItem({
- start: 25.4,
- end: 27,
- color: color20
- });
- var themeGridRange = new SuperMap.ThemeGridRange({
- reverseColor: false,
- rangeMode: SuperMap.RangeMode.EQUALINTERVAL,
- //栅格分段专题图子项数组
- items: [themeGridRangeIteme1, themeGridRangeIteme2,
- themeGridRangeIteme3, themeGridRangeIteme4,
- themeGridRangeIteme5, themeGridRangeIteme6,
- themeGridRangeIteme7, themeGridRangeIteme8,
- themeGridRangeIteme9, themeGridRangeIteme10,
- themeGridRangeIteme11, themeGridRangeIteme12,
- themeGridRangeIteme13, themeGridRangeIteme14,
- themeGridRangeIteme15, themeGridRangeIteme16,
- themeGridRangeIteme17, themeGridRangeIteme18,
- themeGridRangeIteme19, themeGridRangeIteme20
- ]
- });
- var themeParameters = new SuperMap.ThemeParameters({
- //制作专题图的数据集
- datasetNames: [interpolationAnalystResult.dataset.split('@')[0]],
- dataSourceNames: ["Interpolation"],
- joinItems: null,
- themes: [themeGridRange]
- });
- new ol.supermap.ThemeService(baseUrl).getThemeInfo(themeParameters, function (serviceResult) {
- var result = serviceResult.result;
- if (result && result.newResourceID) {
- var themeLayer = new ol.layer.Tile({
- source: new ol.source.TileSuperMapRest({
- url: baseUrl,
- noWrap: true,
- cacheEnabled: false,
- layersID: result.newResourceID,
- tileGrid: new ol.tilegrid.TileGrid({
- extent: extent,
- resolutions: options.tileGrid.getResolutions()
- }),
- transparent: true
- })
- });
- map.addLayer(themeLayer);
- }
- });
- }
- }
- </script>
- </body>
- </html>
|