1+ <!--********************************************************************
2+ * Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
3+ *********************************************************************-->
4+ <!DOCTYPE html>
5+ < html lang ="en ">
6+ < head >
7+ < meta charset ="UTF-8 ">
8+ < title data-i18n ="resources.title_bufferAnalystService_FGB "> </ 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/maplibregl/include-maplibregl.js "> </ script >
14+ < script type ="text/javascript ">
15+ var host = window . isLocal ? window . server : "https://iserver.supermap.io" ;
16+ var map ,
17+ attribution = "<a href='https://maplibre.org/' target='_blank'>© MapLibre </a>" +
18+ " with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
19+ " Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> " ,
20+ baseUrl = host + "/iserver/services/map-jingjin/rest/maps/京津地区地图/zxyTileImage.png?z={z}&x={x}&y={y}" ,
21+ serviceUrl = host + "/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst" ;
22+ map = new maplibregl . Map ( {
23+ container : 'map' ,
24+ style : {
25+ "version" : 8 ,
26+ "sources" : {
27+ "raster-tiles" : {
28+ "attribution" : attribution ,
29+ "type" : "raster" ,
30+ "tiles" : [ baseUrl ] ,
31+ "tileSize" : 256
32+ }
33+ } ,
34+ "layers" : [ {
35+ "id" : "simple-tiles" ,
36+ "type" : "raster" ,
37+ "source" : "raster-tiles" ,
38+ "minzoom" : 2 ,
39+ "maxzoom" : 18
40+ } ]
41+ } ,
42+ center : [ 116.28094998209556 , 39.897168019388474 ] ,
43+ zoom : 12
44+ } ) ;
45+ map . addControl ( new maplibregl . NavigationControl ( ) , 'top-left' ) ;
46+ map . addControl ( new maplibregl . supermap . LogoControl ( { link : "https://iclient.supermap.io" } ) , 'bottom-right' ) ;
47+
48+ map . on ( "load" , function ( ) {
49+ bufferAnalystProcess ( ) ;
50+ } ) ;
51+
52+ function bufferAnalystProcess ( ) {
53+ map . addLayer ( {
54+ "id" : "route" ,
55+ "type" : "line" ,
56+ "source" : {
57+ "type" : "geojson" ,
58+ "data" : {
59+ "type" : "Feature" ,
60+ "geometry" : {
61+ "type" : "LineString" ,
62+ "coordinates" : [
63+ [ 116.2143386597 , 39.8959419733 ] ,
64+ [ 116.2156351162 , 39.8963250173 ] ,
65+ [ 116.2182280292 , 39.8968111885 ] ,
66+ [ 116.2740019864 , 39.8970124079 ] ,
67+ [ 116.3103285499 , 39.8970574832 ] ,
68+ [ 116.3321510064 , 39.8970392162 ] ,
69+ [ 116.3377051439 , 39.8973437531 ] ,
70+ [ 116.3463089006 , 39.8978391816 ] ,
71+ ]
72+ }
73+ }
74+ } ,
75+ "layout" : {
76+ "line-join" : "round" ,
77+ "line-cap" : "round"
78+ } ,
79+ "paint" : {
80+ "line-color" : "#888" ,
81+ "line-width" : 8
82+ }
83+ } ) ;
84+ //缓冲区分析参数
85+ var dsBufferAnalystParameters = new maplibregl . supermap . DatasetBufferAnalystParameters ( {
86+ dataset : "Road_L@Jingjin" ,
87+ filterQueryParameter : new maplibregl . supermap . FilterParameter ( {
88+ attributeFilter : "NAME='莲花池东路'"
89+ } ) ,
90+ bufferSetting : new maplibregl . supermap . BufferSetting ( {
91+ endType : maplibregl . supermap . BufferEndType . ROUND ,
92+ leftDistance : { value : 300 } ,
93+ rightDistance : { value : 300 } ,
94+ semicircleLineSegment : 10 ,
95+ radiusUnit : 'METER'
96+ } )
97+ } ) ;
98+ //缓冲区分析服务 使用 FGB 格式
99+ new maplibregl . supermap . SpatialAnalystService ( serviceUrl ) . bufferAnalysis ( dsBufferAnalystParameters , function ( serviceResult ) {
100+ var FGBLayer = new maplibregl . supermap . FGBLayer ( {
101+ url : serviceResult . result . newResourceLocation ,
102+ strategy : 'all' ,
103+ paint : {
104+ "fill-color" : "red" , /* 填充的颜色 */
105+ "fill-opacity" : 0.4 /* 透明度 */
106+ }
107+ } ) ;
108+ map . addLayer ( FGBLayer ) ;
109+ } , 'FGB' )
110+ }
111+ </ script >
112+ </ body >
113+ </ html >
0 commit comments