123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- import * as layer from 'ol/layer'
- import * as source from 'ol/source'
- // @ts-ignore
- import HaituImg from './images/bg-ocean.png'
- import store from '@/store/index'
- const isInternet = false
- const baseMapView = {
- center: [109.6915958479584, 19.111636735969318],
- projection: "EPSG:4326",
- zoom: 9
- // extent: [120.8953306326286,31.3667480047968,121.37735577911297,31.692561298253832]
- }
- const initBaseLayer = (obj: any) => {
- const layers: any = []
- obj.layersUrl.forEach((v: any) => {
- const s = new source.XYZ({
- projection: "EPSG:4326",
- url: v.url,
- })
- const l = new layer.Tile({
- source: s
- })
- if (v.extent?.length > 0) {
- l.setExtent(v.extent)
- }
- if (v.maxZoom) {
- l.setMaxZoom(v.maxZoom)
- }
- if (v.minZoom) {
- l.setMinZoom(v.minZoom)
- }
- layers.push(l)
- })
- const layerGroup = new layer.Group({
- layers: layers,
- visible: obj.visible,
- })
- layerGroup.set('_maxZoom', obj.maxZoom)
- layerGroup.set('_minZoom', obj.minZoom)
- layerGroup.set('_easyMapOl_layerName', obj.name)
- layerGroup.set('_label', obj.label)
- layerGroup.set('_img', obj.img)
- return layerGroup
- }
- const initInternet = (obj) => {
- const _layer = new layer.Tile({
- source: new source.XYZ({
- url: 'http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}'
- }),
- visible: obj.visible,
- })
- _layer.set('_maxZoom', obj.maxZoom)
- _layer.set('_minZoom', obj.minZoom)
- _layer.set('_easyMapOl_layerName', obj.name)
- _layer.set('_label', obj.label)
- _layer.set('_img', obj.img)
- return _layer
- }
- const baseMapLayers = [
- {
- key: 'LT',
- name: 'base_LT',
- label: '陆图',
- maxZoom: 18,
- minZoom: 1,
- visible: true,
- img: HaituImg,
- layersUrl: [
- {
- url: `/${store.state.app.apiProxy.BaseMap1Api}/vec_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=vec&style=default&opacity=1&zIndex=1&tilematrix={z}&tilerow={y}&tilecol={x}`,
- },
- {
- url: `/${store.state.app.apiProxy.BaseMap2Api}/mapserver/vmap/hn_bigdata_2018dt/getMAP?x={x}&y={y}&l={z}&styleId=hn_bigdata_2018dtys1&ratio=1&tilesize=256&clientVersion=jssdk_bate@%20leaflet%202.1.5`,
- extent: [108.50508936658522, 18.127326424708514, 111.09756659719326, 20.163718157197533]
- },
- {
- url: `/${store.state.app.apiProxy.BaseMap1Api}/cva_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=cva&style=default&zIndex=1&tilematrix={z}&tilerow={y}&tilecol={x}`
- },
- ]
- },
- {
- key: 'HT',
- name: 'base_HT',
- label: '海图',
- maxZoom: 18,
- minZoom: 1,
- visible: false,
- img: HaituImg,
- layersUrl: [
- {
- url: `/${store.state.app.apiProxy.BaseMap1Api}/ter_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=ter&style=default&tilematrix={z}&tilerow={y}&tilecol={x}`,
- },
- {
- url: `/${store.state.app.apiProxy.BaseMap3Api}/ime-cloud/rest/hainan_dem/wmts?service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=default028mm&format=image%2Fjpgpng&height=256&width=256&layer=hainan_dem&style=default&minZoom=8&maxZoom=18&zIndex=4&bounds=17.17616389817063%2C106.9017014531631%2C21.04474386095089%2C113.04819115525501&tilematrix={z}&tilerow={y}&tilecol={x}`,
- maxZoom: 18,
- minZoom: 8,
- extent: [106.9017014531631, 17.17616389817063, 113.04819115525501, 21.04474386095089]
- },
- {
- url: `/${store.state.app.apiProxy.BaseMap1Api}/cta_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=cta&style=default&tilematrix={z}&tilerow={y}&tilecol={x}`,
- },
- ]
- },
- {
- key: 'WXT',
- name: 'base_WXT',
- label: '卫星图',
- maxZoom: 18,
- minZoom: 1,
- visible: false,
- img: HaituImg,
- layersUrl: [
- {
- url: `/${store.state.app.apiProxy.BaseMap1Api}/img_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=img&style=default&opacity=0.6&zIndex=1&tilematrix={z}&tilerow={y}&tilecol={x}`,
- },
- {
- url: `/${store.state.app.apiProxy.BaseMap3Api}/ime-cloud/rest/hainan_img_2018/wmts?service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=default028mm&format=image%2Fjpgpng&height=256&width=256&layer=hainan_img_2018&style=default&minZoom=8&maxZoom=18&zIndex=4&bounds=13.257020557028%2C103.34794430865948%2C23.46552385201528%2C114.30558768331025&tilematrix={z}&tilerow={y}&tilecol={x}`,
- extent: [103.34794430865948, 13.257020557028, 114.30558768331025, 23.46552385201528]
- },
- {
- url: `/${store.state.app.apiProxy.BaseMap1Api}/cia_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=cia&style=default&zIndex=4&tilematrix={z}&tilerow={y}&tilecol={x}`,
- },
- ]
- },
- {
- key: 'HYS',
- name: 'base_HYS',
- label: '黑元素',
- maxZoom: 18,
- minZoom: 1,
- visible: false,
- img: HaituImg,
- layersUrl: [
- {
- url: `/${store.state.app.apiProxy.BaseMap2Api}/mapserver/vmap/hn_bigdata_2018dt/getMAP?x={x}&y={y}&l={z}&styleId=hn_bigdata_2018dtys2&ratio=1&tilesize=256&clientVersion=jssdk_bate@%20leaflet%202.1.5`,
- },
- {
- url: `/${store.state.app.apiProxy.BaseMap1Api}/cta_c/wmts?tk=%E6%82%A8%E7%9A%84%E5%AF%86%E9%92%A5&service=WMTS&request=GetTile&version=1.0.0&layers=&styles=&tilematrixSet=c&format=tiles&height=256&width=256&layer=cta&style=default&tilematrix={z}&tilerow={y}&tilecol={x}`,
- },
- ]
- },
- ]
- export default {
- baseMapView,
- baseMapLayers,
- initBaseLayer,
- initInternet,
- isInternet
- }
|