04_surfaceAnalystService.html 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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_surfaceAnalystService"></title>
  9. <script type="text/javascript" src="../js/include-web.js"></script>
  10. </head>
  11. <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
  12. <div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
  13. <script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
  14. <script type="text/javascript">
  15. var host = window.isLocal ? window.server : "https://iserver.supermap.io";
  16. var map, region, resultLayer, surfaceAnalystService, surfaceAnalystParameters,
  17. baseUrl = host + "/iserver/services/map-temperature/rest/maps/全国温度变化图",
  18. serviceUrl = host + "/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst";
  19. map = L.map('map', {
  20. crs: L.CRS.NonEarthCRS({
  21. bounds: L.bounds([-2640403.63, 1873792.1], [3247669.39, 5921501.4]),
  22. origin: L.point(-2640403.63, 5921501.4)
  23. }),
  24. center: [3580330, 531762],
  25. maxZoom: 18,
  26. zoom: 2
  27. });
  28. L.supermap.tiledMapLayer(baseUrl, {noWrap: true}).addTo(map).once("load", function () {
  29. surfaceAnalystProcess();
  30. });
  31. function surfaceAnalystProcess() {
  32. region = L.polygon([
  33. [4010338, 0],
  34. [4010338, 1063524],
  35. [3150322, 1063524],
  36. [3150322, 0]
  37. ]);
  38. surfaceAnalystParameters = new SuperMap.DatasetSurfaceAnalystParameters({
  39. extractParameter: new SuperMap.SurfaceAnalystParametersSetting({
  40. datumValue: 0,
  41. interval: 2,
  42. resampleTolerance: 0,
  43. smoothMethod: SuperMap.SmoothMethod.BSPLINE,
  44. smoothness: 3,
  45. clipRegion: region
  46. }),
  47. dataset: "SamplesP@Interpolation",
  48. resolution: 9000,
  49. zValueFieldName: "AVG_TMP"
  50. });
  51. surfaceAnalystService = L.supermap.spatialAnalystService(serviceUrl);
  52. surfaceAnalystService.surfaceAnalysis(surfaceAnalystParameters, function (serviceResult) {
  53. var result = serviceResult.result;
  54. if (result && result.recordset && result.recordset.features) {
  55. resultLayer = L.geoJSON(result.recordset.features, {weight: 3}).addTo(map);
  56. } else {
  57. alert(serviceResult.error.errorMsg);
  58. }
  59. });
  60. }
  61. </script>
  62. </body>
  63. </html>