mapcodes.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. var disProvince1 = new AMap.DistrictLayer.Province({
  2. zIndex:14,
  3. adcode:'110000',
  4. deep:2,
  5. styles:{
  6. polygon:{
  7. fillColor:'#122442'
  8. },
  9. polyline:{
  10. strokeColor:function(properties){
  11. var type = properties.type;
  12. switch(type){
  13. case 'Province_Border_China':return '#406795'//中国省界
  14. case 'Province_Border_Foreign': return 'cornflowerblue';//外国省界
  15. case 'City_Border_China': return '#122442';//中国地级市边界
  16. case 'County_Border_China': return '#122442';//中国区县边界
  17. }
  18. }
  19. }
  20. }
  21. });
  22. var disProvince2 = new AMap.DistrictLayer.Province({
  23. zIndex:14,
  24. adcode:'120000',
  25. deep:2,
  26. styles:{
  27. polygon:{
  28. fillColor:'#122442'
  29. },
  30. polyline:{
  31. strokeColor:function(properties){
  32. var type = properties.type;
  33. switch(type){
  34. case 'Province_Border_China':return '#406795'//中国省界
  35. case 'Province_Border_Foreign': return 'cornflowerblue';//外国省界
  36. case 'City_Border_China': return '#122442';//中国地级市边界
  37. case 'County_Border_China': return '#122442';//中国区县边界
  38. }
  39. }
  40. }
  41. }
  42. });
  43. var disProvince3 = new AMap.DistrictLayer.Province({
  44. zIndex:14,
  45. adcode:'130000',
  46. deep:2,
  47. styles:{
  48. polygon:{
  49. fillColor:'#122442'
  50. },
  51. polyline:{
  52. strokeColor:function(properties){
  53. var type = properties.type;
  54. switch(type){
  55. case 'Province_Border_China':return '#406795'//中国省界
  56. case 'Province_Border_Foreign': return 'cornflowerblue';//外国省界
  57. case 'City_Border_China': return '#122442';//中国地级市边界
  58. case 'County_Border_China': return '#122442';//中国区县边界
  59. }
  60. }
  61. }
  62. }
  63. });
  64. var disProvince4 = new AMap.DistrictLayer.Province({
  65. zIndex:14,
  66. adcode:'150000',
  67. deep:2,
  68. styles:{
  69. polygon:{
  70. fillColor:'#122442'
  71. },
  72. polyline:{
  73. strokeColor:function(properties){
  74. var type = properties.type;
  75. switch(type){
  76. case 'Province_Border_China':return '#406795'//中国省界
  77. case 'Province_Border_Foreign': return 'cornflowerblue';//外国省界
  78. case 'City_Border_China': return '#122442';//中国地级市边界
  79. case 'County_Border_China': return '#122442';//中国区县边界
  80. }
  81. }
  82. }
  83. }
  84. });
  85. var disProvince5 = new AMap.DistrictLayer.Province({
  86. zIndex:14,
  87. adcode:'640000',
  88. deep:2,
  89. styles:{
  90. polygon:{
  91. fillColor:'#122442'
  92. },
  93. polyline:{
  94. strokeColor:function(properties){
  95. var type = properties.type;
  96. switch(type){
  97. case 'Province_Border_China':return '#406795'//中国省界
  98. case 'Province_Border_Foreign': return 'cornflowerblue';//外国省界
  99. case 'City_Border_China': return '#122442';//中国地级市边界
  100. case 'County_Border_China': return '#122442';//中国区县边界
  101. }
  102. }
  103. }
  104. }
  105. });
  106. var disProvince6 = new AMap.DistrictLayer.Province({
  107. zIndex:14,
  108. adcode:'610000',
  109. deep:2,
  110. styles:{
  111. polygon:{
  112. fillColor:'#122442'
  113. },
  114. polyline:{
  115. strokeColor:function(properties){
  116. var type = properties.type;
  117. switch(type){
  118. case 'Province_Border_China':return '#406795'//中国省界
  119. case 'Province_Border_Foreign': return 'cornflowerblue';//外国省界
  120. case 'City_Border_China': return '#122442';//中国地级市边界
  121. case 'County_Border_China': return '#122442';//中国区县边界
  122. }
  123. }
  124. }
  125. }
  126. });
  127. var disProvince7 = new AMap.DistrictLayer.Province({
  128. zIndex:14,
  129. adcode:'620000',
  130. deep:2,
  131. styles:{
  132. polygon:{
  133. fillColor:'#122442'
  134. },
  135. polyline:{
  136. strokeColor:function(properties){
  137. var type = properties.type;
  138. switch(type){
  139. case 'Province_Border_China':return '#406795'//中国省界
  140. case 'Province_Border_Foreign': return 'cornflowerblue';//外国省界
  141. case 'City_Border_China': return '#122442';//中国地级市边界
  142. case 'County_Border_China': return '#122442';//中国区县边界
  143. }
  144. }
  145. }
  146. }
  147. });
  148. var disProvince8 = new AMap.DistrictLayer.Province({
  149. zIndex:14,
  150. adcode:'410000',
  151. deep:2,
  152. styles:{
  153. polygon:{
  154. fillColor:'#122442'
  155. },
  156. polyline:{
  157. strokeColor:function(properties){
  158. var type = properties.type;
  159. switch(type){
  160. case 'Province_Border_China':return '#406795'//中国省界
  161. case 'Province_Border_Foreign': return 'cornflowerblue';//外国省界
  162. case 'City_Border_China': return '#122442';//中国地级市边界
  163. case 'County_Border_China': return '#122442';//中国区县边界
  164. }
  165. }
  166. }
  167. }
  168. });
  169. var disProvince9 = new AMap.DistrictLayer.Province({
  170. zIndex:14,
  171. adcode:'370000',
  172. deep:2,
  173. styles:{
  174. polygon:{
  175. fillColor:'#122442'
  176. },
  177. polyline:{
  178. strokeColor:function(properties){
  179. var type = properties.type;
  180. switch(type){
  181. case 'Province_Border_China':return '#406795'//中国省界
  182. case 'Province_Border_Foreign': return 'cornflowerblue';//外国省界
  183. case 'City_Border_China': return '#122442';//中国地级市边界
  184. case 'County_Border_China': return '#122442';//中国区县边界
  185. }
  186. }
  187. }
  188. }
  189. });
  190. var disProvince10 = new AMap.DistrictLayer.Province({
  191. zIndex:14,
  192. adcode:'320000',
  193. deep:2,
  194. styles:{
  195. polygon:{
  196. fillColor:'#122442'
  197. },
  198. polyline:{
  199. strokeColor:function(properties){
  200. var type = properties.type;
  201. switch(type){
  202. case 'Province_Border_China':return '#406795'//中国省界
  203. case 'Province_Border_Foreign': return 'cornflowerblue';//外国省界
  204. case 'City_Border_China': return '#122442';//中国地级市边界
  205. case 'County_Border_China': return '#122442';//中国区县边界
  206. }
  207. }
  208. }
  209. }
  210. });
  211. var disProvince11 = new AMap.DistrictLayer.Province({
  212. zIndex:14,
  213. adcode:'340000',
  214. deep:2,
  215. styles:{
  216. polygon:{
  217. fillColor:'#122442'
  218. },
  219. polyline:{
  220. strokeColor:function(properties){
  221. var type = properties.type;
  222. switch(type){
  223. case 'Province_Border_China':return '#406795'//中国省界
  224. case 'Province_Border_Foreign': return 'cornflowerblue';//外国省界
  225. case 'City_Border_China': return '#122442';//中国地级市边界
  226. case 'County_Border_China': return '#122442';//中国区县边界
  227. }
  228. }
  229. }
  230. }
  231. });
  232. var disProvince12 = new AMap.DistrictLayer.Province({
  233. zIndex:14,
  234. adcode:'210000',
  235. deep:2,
  236. styles:{
  237. polygon:{
  238. fillColor:'#122442'
  239. },
  240. polyline:{
  241. strokeColor:function(properties){
  242. var type = properties.type;
  243. switch(type){
  244. case 'Province_Border_China':return '#406795'//中国省界
  245. case 'Province_Border_Foreign': return 'cornflowerblue';//外国省界
  246. case 'City_Border_China': return '#122442';//中国地级市边界
  247. case 'County_Border_China': return '#122442';//中国区县边界
  248. }
  249. }
  250. }
  251. }
  252. });
  253. var map = new AMap.Map('container', {
  254. resizeEnable: true,
  255. zoom:6,
  256. zooms:[6,18],
  257. center: [112.47485,37.789585]
  258. });
  259. map.setMapStyle('amap://styles/87fc86ed648cae752d097a75f4744133');
  260. map.add(disProvince1);
  261. map.add(disProvince2);
  262. map.add(disProvince3);
  263. map.add(disProvince4);
  264. map.add(disProvince5);
  265. map.add(disProvince6);
  266. map.add(disProvince7);
  267. map.add(disProvince8);
  268. map.add(disProvince9);
  269. map.add(disProvince10);
  270. map.add(disProvince11);
  271. map.add(disProvince12);
  272. var trafficLayer = new AMap.TileLayer.Traffic({
  273. zIndex: 10
  274. });
  275. trafficLayer.setMap(map);