04_bufferAnalystService.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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_bufferAnalystService"></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, roadLine, dsBufferAnalystService, dsBufferAnalystParameters, resultLayer,
  17. baseUrl = host + "/iserver/services/map-changchun/rest/maps/长春市区图",
  18. serviceUrl = host + "/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst";
  19. map = L.map('map', {
  20. crs: L.CRS.NonEarthCRS({
  21. bounds: L.bounds([48.4, -7668.25], [8958.85, -55.58]),
  22. origin: L.point(48.4, -55.58)
  23. }),
  24. center: [-3375, 5105],
  25. maxZoom: 18,
  26. zoom: 6
  27. });
  28. L.supermap.tiledMapLayer(baseUrl, {noWrap: true}).addTo(map).once("load", function () {
  29. bufferAnalystProcess();
  30. });
  31. function bufferAnalystProcess() {
  32. roadLine = L.polyline([
  33. [-3337.3849141502124, 4933.319287022352],
  34. [-3349.3316322355736, 4960.9674060199022],
  35. [-3358.8890067038628, 5006.0235999418364],
  36. [-3378.0037556404409, 5075.3145648369318],
  37. [-3376.9669111768926, 5305.19551436013]
  38. ]).addTo(map);
  39. dsBufferAnalystService = L.supermap.spatialAnalystService(serviceUrl);
  40. dsBufferAnalystParameters = new SuperMap.DatasetBufferAnalystParameters({
  41. dataset: "RoadLine2@Changchun",
  42. filterQueryParameter: new SuperMap.FilterParameter({
  43. attributeFilter: "NAME='团结路'"
  44. }),
  45. bufferSetting: new SuperMap.BufferSetting({
  46. endType: SuperMap.BufferEndType.ROUND,
  47. leftDistance: {value: 10},
  48. rightDistance: {value: 10},
  49. semicircleLineSegment: 10
  50. })
  51. });
  52. dsBufferAnalystService.bufferAnalysis(dsBufferAnalystParameters, function (serviceResult) {
  53. var result = serviceResult.result;
  54. resultLayer = L.geoJSON(result.recordset.features, {color: "red"}).addTo(map);
  55. });
  56. }
  57. </script>
  58. </body>
  59. </html>