1+ <!DOCTYPE html>
2+ < html >
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < title > 统计专题图</ title >
6+ </ head >
7+ < body style =" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0; ">
8+ < div id ="title " style ="position:absolute;top: 10px;text-align:center;width:100%;z-index: 10;color: #f7931e ">
9+ 全国省份2013和2014年GDP统计
10+ </ div >
11+ < div id ="map " style ="margin:0 auto;width: 100%;height: 100% "> </ div >
12+ < script type ="text/javascript " src ="../../dist/include-mapboxgl.js "> </ script >
13+ < span id ="show "> </ span >
14+ < script type ="text/javascript ">
15+ mapboxgl . accessToken = 'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4M29iazA2Z2gycXA4N2pmbDZmangifQ.-g_vE53SD2WrJ6tFX7QHmA' ;
16+ var host = window . isLocal ? document . location . protocol + "//" + document . location . host : "http://support.supermap.com.cn:8090" ;
17+
18+ var attribution = "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
19+ "| Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> " + " with <span>© <a href='http://iclient.supermapol.com' target='_blank'>SuperMap iClient</a></span>" ;
20+
21+ var dataUrl = host + "/iserver/services/map-china400/rest/maps/China" ;
22+ var map = new mapboxgl . Map ( {
23+ container : 'map' ,
24+ style : {
25+ "version" : 8 ,
26+ "sources" : {
27+ "raster-tiles" : {
28+ "attribution" : attribution ,
29+ "type" : "raster" ,
30+ "tiles" : [ host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?&z={z}&x={x}&y={y}' ] ,
31+ "tileSize" : 256 ,
32+ } ,
33+ } ,
34+ "layers" : [ {
35+ "id" : "simple-tiles" ,
36+ "type" : "raster" ,
37+ "source" : "raster-tiles" ,
38+ "minzoom" : 0 ,
39+ "maxzoom" : 22
40+ } ]
41+ } ,
42+ center : [ 104 , 38 ] ,
43+ zoom : 3.55
44+ } ) ;
45+ map . addControl ( new mapboxgl . NavigationControl ( ) , 'top-left' ) ;
46+ map . addControl ( new mapboxgl . supermap . LogoControl ( ) , 'bottom-right' ) ;
47+
48+ function createTheme ( ) {
49+ themeGraph = new SuperMap . ThemeGraph ( {
50+ items : [
51+ new SuperMap . ThemeGraphItem ( {
52+ caption : "全国省份2013_GDP" ,
53+ graphExpression : "GDP_2013" ,
54+ uniformStyle : new SuperMap . ServerStyle ( {
55+ fillForeColor : new SuperMap . ServerColor ( 255 , 215 , 0 ) ,
56+ lineWidth : 0
57+ } )
58+ } ) ,
59+ new SuperMap . ThemeGraphItem ( {
60+ caption : "全国省份2014_GDP" ,
61+ graphExpression : "GDP_2014" ,
62+ uniformStyle : new SuperMap . ServerStyle ( {
63+ fillForeColor : new SuperMap . ServerColor ( 0 , 191 , 255 ) ,
64+ lineWidth : 0
65+ } )
66+ } ) ,
67+ ] ,
68+ barWidth : 0.001 ,
69+ graduatedMode : SuperMap . GraduatedMode . CONSTANT ,
70+ graphAxes : new SuperMap . ThemeGraphAxes ( {
71+ axesDisplayed : true
72+ } ) ,
73+ graphSize : new SuperMap . ThemeGraphSize ( {
74+ maxGraphSize : 500000 ,
75+ minGraphSize : 200000
76+ } ) ,
77+ graphText : new SuperMap . ThemeGraphText ( {
78+ graphTextDisplayed : true ,
79+ graphTextFormat : SuperMap . ThemeGraphTextFormat . VALUE ,
80+ graphTextStyle : new SuperMap . ServerTextStyle ( {
81+ fontHeight : 10 ,
82+ fontWidth : 10
83+ } )
84+ } ) ,
85+ overlapAvoided : false ,
86+ graphSizeFixed : false ,
87+ graphType : SuperMap . ThemeGraphType . BAR
88+ } ) ;
89+ themeParameters = new SuperMap . ThemeParameters ( {
90+ themes : [ themeGraph ] ,
91+ datasetNames : [ "China_Province_pg" ] ,
92+ dataSourceNames : [ "China" ]
93+
94+ } ) ;
95+
96+ new mapboxgl . supermap . ThemeService ( dataUrl ) . getThemeInfo ( themeParameters , function ( serviceResult ) {
97+ var result = serviceResult . result ;
98+ if ( result && result . newResourceID ) {
99+ map . addSource ( "theme" , {
100+ "type" : 'raster' ,
101+ "tiles" : [ host + '/iserver/services/map-china400/rest/maps/China/zxyTileImage.png?z={z}&x={x}&y={y}&transparent=true&cacheEnabled=false&layersID=' + result . newResourceID ] ,
102+ "tileSize" : 256 ,
103+ } ) ;
104+
105+ map . addLayer ( {
106+ "id" : "themeLayer" ,
107+ "type" : "raster" ,
108+ "source" : "theme" ,
109+ } ) ;
110+ }
111+ } )
112+ }
113+
114+ map . on ( 'load' , function ( ) {
115+
116+ createTheme ( ) ;
117+ } ) ;
118+
119+ </ script >
120+
121+ </ body >
122+ </ html >
0 commit comments