20191218
Showing
3 changed files
with
36 additions
and
8 deletions
| ... | @@ -2,8 +2,8 @@ | ... | @@ -2,8 +2,8 @@ |
| 2 | * Mapbox GL展示天地图数据 | 2 | * Mapbox GL展示天地图数据 |
| 3 | * @Author: jiangbotao | 3 | * @Author: jiangbotao |
| 4 | * @Date: 2019-12-09 23:17:48 | 4 | * @Date: 2019-12-09 23:17:48 |
| 5 | * @LastEditors: jiangbotao | 5 | * @LastEditors : jiangbotao |
| 6 | * @LastEditTime: 2019-12-18 00:17:04 | 6 | * @LastEditTime : 2019-12-18 09:32:51 |
| 7 | * @FilePath: \mymapbox\src\components\Map3857.vue | 7 | * @FilePath: \mymapbox\src\components\Map3857.vue |
| 8 | --> | 8 | --> |
| 9 | <template> | 9 | <template> | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Author: jiangbotao | 2 | * @Author: jiangbotao |
| 3 | * @Date: 2019-12-18 00:23:47 | 3 | * @Date: 2019-12-18 00:23:47 |
| 4 | * @LastEditors: jiangbotao | 4 | * @LastEditors : jiangbotao |
| 5 | * @LastEditTime: 2019-12-18 01:43:58 | 5 | * @LastEditTime : 2019-12-18 09:27:40 |
| 6 | * @FilePath: \supermapvue\src\components\layers\Map_mapbox.vue | 6 | * @FilePath: \supermapvue\src\components\layers\Map_mapbox.vue |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| ... | @@ -27,18 +27,46 @@ export default { | ... | @@ -27,18 +27,46 @@ export default { |
| 27 | $.ajax({ | 27 | $.ajax({ |
| 28 | type: "GET", | 28 | type: "GET", |
| 29 | url: "http://www.zjditu.cn/vtiles/styles/tdt/streets.json", | 29 | url: "http://www.zjditu.cn/vtiles/styles/tdt/streets.json", |
| 30 | type: 'get', | ||
| 31 | dataType: 'json', // 请求方式为jsonp | ||
| 32 | crossDomain: true, | ||
| 30 | success: function(data){ | 33 | success: function(data){ |
| 31 | console.log(data); | 34 | console.log(data); |
| 35 | // var mapboxgl_style = 'http://www.zjditu.cn/vtiles/styles/tdt/dark.json'; | ||
| 32 | var map = new mapboxgl.Map({ | 36 | var map = new mapboxgl.Map({ |
| 33 | container: 'map', | 37 | container: 'map', |
| 34 | zoom: 12, | 38 | zoom: 12, |
| 35 | center: [120.15, 30.25], | 39 | center: [120.15, 30.25], |
| 36 | renderWorldCopies: false, | 40 | renderWorldCopies: false, |
| 37 | localIdeographFontFamily: "'黑体','san-serif'", | 41 | localIdeographFontFamily: "'黑体','san-serif'", |
| 38 | style: data | 42 | pitch: 50, |
| 43 | bearing: -10, | ||
| 44 | style: { | ||
| 45 | "version": data.version, | ||
| 46 | "sources": data.sources, | ||
| 47 | "sprite": data.sprite, | ||
| 48 | "glyphs": data.glyphs, | ||
| 49 | "layers": data.layers | ||
| 50 | }, | ||
| 51 | shading: 'realistic', | ||
| 52 | light: { | ||
| 53 | main: { | ||
| 54 | intensity: 0.5, | ||
| 55 | shadow: false | ||
| 56 | }, | ||
| 57 | ambient: { | ||
| 58 | intensity: 0.2 | ||
| 59 | }, | ||
| 60 | ambientCubemap: { | ||
| 61 | exposure: 1, | ||
| 62 | diffuseIntensity: 0.5, | ||
| 63 | specularIntensity: 2 | ||
| 64 | } | ||
| 65 | }, | ||
| 66 | zlevel: 1 | ||
| 39 | }); | 67 | }); |
| 40 | map.addControl(new mapboxgl.NavigationControl(), 'top-left'); | 68 | map.addControl(new mapboxgl.NavigationControl(), 'top-left'); |
| 41 | } | 69 | } |
| 42 | }); | 70 | }); |
| 43 | } | 71 | } |
| 44 | } | 72 | } | ... | ... |
| ... | @@ -7,8 +7,8 @@ | ... | @@ -7,8 +7,8 @@ |
| 7 | * - positron | 7 | * - positron |
| 8 | * @Author: jiangbotao | 8 | * @Author: jiangbotao |
| 9 | * @Date: 2019-12-09 23:17:48 | 9 | * @Date: 2019-12-09 23:17:48 |
| 10 | * @LastEditors: jiangbotao | 10 | * @LastEditors : jiangbotao |
| 11 | * @LastEditTime: 2019-12-12 18:34:35 | 11 | * @LastEditTime : 2019-12-18 09:55:26 |
| 12 | * @FilePath: \mymapbox\src\components\Map3857.vue | 12 | * @FilePath: \mymapbox\src\components\Map3857.vue |
| 13 | --> | 13 | --> |
| 14 | <template> | 14 | <template> | ... | ... |
-
Please register or sign in to post a comment