04_interpolationAnalystService_RBF.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <meta charset="UTF-8">
  8. <title data-i18n="resources.title_interpolationAnalystByRBF"></title>
  9. <script type="text/javascript" src="../js/include-web.js"></script>
  10. <script type="text/javascript" src="../../dist/ol/include-ol.js"></script>
  11. </head>
  12. <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%; position: absolute;top: 0;">
  13. <div id="map" style="width: 100%;height:100%"></div>
  14. <script type="text/javascript">
  15. var map, options, interpolationAnalystResult,
  16. baseUrl = (window.isLocal ? window.server : "https://iserver.supermap.io")+"/iserver/services/map-temperature/rest/maps/全国温度变化图",
  17. serviceUrl = (window.isLocal ? window.server : "https://iserver.supermap.io")+"/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst";
  18. var extent = [-2640403.63, 1873792.1, 3247669.39, 5921501.4];
  19. var projection = new ol.proj.Projection({
  20. code:'',
  21. extent: extent,
  22. units: 'm'
  23. });
  24. new ol.supermap.MapService(baseUrl).getMapInfo(function (serviceResult) {
  25. var mapJSONObj = serviceResult.result;
  26. map = new ol.Map({
  27. target: 'map',
  28. controls: ol.control.defaults({attributionOptions: {collapsed: false}})
  29. .extend([new ol.supermap.control.Logo()]),
  30. view: new ol.View({
  31. center: [531762, 3580330],
  32. zoom: 1,
  33. projection: projection,
  34. multiWorld: true
  35. })
  36. });
  37. options = ol.source.TileSuperMapRest.optionsFromMapJSON(baseUrl, mapJSONObj);
  38. options.layersID = "[0,1,2]";
  39. var layer = new ol.layer.Tile({
  40. source: new ol.source.TileSuperMapRest(options)
  41. });
  42. map.addLayer(layer);
  43. interpolationAnalystProcess();
  44. });
  45. function interpolationAnalystProcess() {
  46. //创建点密度插值分析参数实例
  47. var interpolationAnalystParameters = new SuperMap.InterpolationRBFAnalystParameters({
  48. //用于做插值分析的数据源中数据集的名称
  49. dataset: "SamplesP@Interpolation",
  50. //插值分析结果数据集的名称
  51. outputDatasetName: "RBF_Result",
  52. //插值分析结果数据源的名称
  53. outputDatasourceName: "Interpolation",
  54. //结果栅格数据集存储的像素格式
  55. pixelFormat: SuperMap.PixelFormat.DOUBLE,
  56. // 属性过滤条件
  57. // filterQueryParameter: {
  58. // attributeFilter: ""
  59. // },
  60. // 存储用于进行插值分析的字段名称
  61. zValueFieldName: "AVG_TMP",
  62. //采取固定点数查找参与运算点的方式,此方式下,参与差值运算的点数默认为12。
  63. searchMode: "KDTREE_FIXED_COUNT",
  64. bounds: [-2640403.63, 1873792.1, 3247669.39, 5921501.4]
  65. });
  66. new ol.supermap.SpatialAnalystService(serviceUrl).interpolationAnalysis(interpolationAnalystParameters, function (serviceResult) {
  67. interpolationAnalystResult = serviceResult.result;
  68. //用栅格专题图展示分析结果
  69. showAnalysisResult_ThemeGridRange();
  70. });
  71. //构造栅格专题图
  72. function showAnalysisResult_ThemeGridRange() {
  73. var color1 = new SuperMap.ServerColor(170, 240, 233),
  74. color2 = new SuperMap.ServerColor(176, 244, 188),
  75. color3 = new SuperMap.ServerColor(218, 251, 178),
  76. color4 = new SuperMap.ServerColor(220, 236, 145),
  77. color5 = new SuperMap.ServerColor(96, 198, 66),
  78. color6 = new SuperMap.ServerColor(20, 142, 53),
  79. color7 = new SuperMap.ServerColor(85, 144, 55),
  80. color8 = new SuperMap.ServerColor(171, 168, 38),
  81. color9 = new SuperMap.ServerColor(235, 165, 9),
  82. color10 = new SuperMap.ServerColor(203, 89, 2),
  83. color11 = new SuperMap.ServerColor(157, 25, 1),
  84. color12 = new SuperMap.ServerColor(118, 15, 3),
  85. color13 = new SuperMap.ServerColor(112, 32, 7),
  86. color14 = new SuperMap.ServerColor(106, 45, 12),
  87. color15 = new SuperMap.ServerColor(129, 80, 50),
  88. color16 = new SuperMap.ServerColor(160, 154, 146),
  89. color17 = new SuperMap.ServerColor(107, 47, 14),
  90. color18 = new SuperMap.ServerColor(125, 75, 44),
  91. color19 = new SuperMap.ServerColor(146, 110, 88),
  92. color20 = new SuperMap.ServerColor(166, 153, 146);
  93. var themeGridRangeIteme1 = new SuperMap.ThemeGridRangeItem({
  94. start: -5,
  95. end: -3.4,
  96. color: color1
  97. }),
  98. themeGridRangeIteme2 = new SuperMap.ThemeGridRangeItem({
  99. start: -3.4,
  100. end: -1.8,
  101. color: color2
  102. }),
  103. themeGridRangeIteme3 = new SuperMap.ThemeGridRangeItem({
  104. start: -1.8,
  105. end: -0.2,
  106. color: color3
  107. }),
  108. themeGridRangeIteme4 = new SuperMap.ThemeGridRangeItem({
  109. start: -0.2,
  110. end: 1.4,
  111. color: color4
  112. }),
  113. themeGridRangeIteme5 = new SuperMap.ThemeGridRangeItem({
  114. start: 1.4,
  115. end: 3,
  116. color: color5
  117. }),
  118. themeGridRangeIteme6 = new SuperMap.ThemeGridRangeItem({
  119. start: 3,
  120. end: 4.6,
  121. color: color6
  122. }),
  123. themeGridRangeIteme7 = new SuperMap.ThemeGridRangeItem({
  124. start: 4.6,
  125. end: 6.2,
  126. color: color7
  127. }),
  128. themeGridRangeIteme8 = new SuperMap.ThemeGridRangeItem({
  129. start: 6.2,
  130. end: 7.8,
  131. color: color8
  132. }),
  133. themeGridRangeIteme9 = new SuperMap.ThemeGridRangeItem({
  134. start: 7.8,
  135. end: 9.4,
  136. color: color9
  137. }),
  138. themeGridRangeIteme10 = new SuperMap.ThemeGridRangeItem({
  139. start: 9.4,
  140. end: 11,
  141. color: color10
  142. }),
  143. themeGridRangeIteme11 = new SuperMap.ThemeGridRangeItem({
  144. start: 11,
  145. end: 12.6,
  146. color: color11
  147. }),
  148. themeGridRangeIteme12 = new SuperMap.ThemeGridRangeItem({
  149. start: 12.6,
  150. end: 14.2,
  151. color: color12
  152. }),
  153. themeGridRangeIteme13 = new SuperMap.ThemeGridRangeItem({
  154. start: 14.2,
  155. end: 15.8,
  156. color: color13
  157. }),
  158. themeGridRangeIteme14 = new SuperMap.ThemeGridRangeItem({
  159. start: 15.8,
  160. end: 17.4,
  161. color: color14
  162. }),
  163. themeGridRangeIteme15 = new SuperMap.ThemeGridRangeItem({
  164. start: 17.4,
  165. end: 19,
  166. color: color15
  167. }),
  168. themeGridRangeIteme16 = new SuperMap.ThemeGridRangeItem({
  169. start: 19,
  170. end: 20.6,
  171. color: color16
  172. }),
  173. themeGridRangeIteme17 = new SuperMap.ThemeGridRangeItem({
  174. start: 20.6,
  175. end: 22.2,
  176. color: color17
  177. }),
  178. themeGridRangeIteme18 = new SuperMap.ThemeGridRangeItem({
  179. start: 22.2,
  180. end: 23.8,
  181. color: color18
  182. }),
  183. themeGridRangeIteme19 = new SuperMap.ThemeGridRangeItem({
  184. start: 23.8,
  185. end: 25.4,
  186. color: color19
  187. }),
  188. themeGridRangeIteme20 = new SuperMap.ThemeGridRangeItem({
  189. start: 25.4,
  190. end: 27,
  191. color: color20
  192. });
  193. var themeGridRange = new SuperMap.ThemeGridRange({
  194. reverseColor: false,
  195. rangeMode: SuperMap.RangeMode.EQUALINTERVAL,
  196. //栅格分段专题图子项数组
  197. items: [themeGridRangeIteme1, themeGridRangeIteme2,
  198. themeGridRangeIteme3, themeGridRangeIteme4,
  199. themeGridRangeIteme5, themeGridRangeIteme6,
  200. themeGridRangeIteme7, themeGridRangeIteme8,
  201. themeGridRangeIteme9, themeGridRangeIteme10,
  202. themeGridRangeIteme11, themeGridRangeIteme12,
  203. themeGridRangeIteme13, themeGridRangeIteme14,
  204. themeGridRangeIteme15, themeGridRangeIteme16,
  205. themeGridRangeIteme17, themeGridRangeIteme18,
  206. themeGridRangeIteme19, themeGridRangeIteme20
  207. ]
  208. });
  209. var themeParameters = new SuperMap.ThemeParameters({
  210. //制作专题图的数据集
  211. datasetNames: [interpolationAnalystResult.dataset.split('@')[0]],
  212. dataSourceNames: ["Interpolation"],
  213. joinItems: null,
  214. themes: [themeGridRange]
  215. });
  216. new ol.supermap.ThemeService(baseUrl).getThemeInfo(themeParameters, function (serviceResult) {
  217. var result = serviceResult.result;
  218. if (result && result.newResourceID) {
  219. var themeLayer = new ol.layer.Tile({
  220. source: new ol.source.TileSuperMapRest({
  221. url: baseUrl,
  222. noWrap: true,
  223. cacheEnabled: false,
  224. layersID: result.newResourceID,
  225. tileGrid: new ol.tilegrid.TileGrid({
  226. extent: extent,
  227. resolutions: options.tileGrid.getResolutions()
  228. }),
  229. transparent: true
  230. })
  231. });
  232. map.addLayer(themeLayer);
  233. }
  234. });
  235. }
  236. }
  237. </script>
  238. </body>
  239. </html>