Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
W
whp-xl
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhichao
whp-xl
Commits
366b1d5d
Commit
366b1d5d
authored
Jun 17, 2021
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
危化地图 gengdidi
parent
e2e478fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
49 deletions
+28
-49
mapUtil.js
dcit-hcsystem-hcsystem-master/src/utils/mapUtil.js
+28
-48
qyMap.vue
dcit-hcsystem-hcsystem-master/src/views/qyMap/qyMap.vue
+0
-1
No files found.
dcit-hcsystem-hcsystem-master/src/utils/mapUtil.js
View file @
366b1d5d
...
@@ -11,7 +11,7 @@ import TileLayer from "ol/layer/Tile";
...
@@ -11,7 +11,7 @@ import TileLayer from "ol/layer/Tile";
import
XYZ
from
"ol/source/XYZ"
;
import
XYZ
from
"ol/source/XYZ"
;
import
LayerGroup
from
"ol/layer/Group"
;
import
LayerGroup
from
"ol/layer/Group"
;
import
{
fromLonLat
,
toLonLat
,
transform
}
from
"ol/proj"
;
import
{
fromLonLat
,
toLonLat
,
transform
,
get
}
from
"ol/proj"
;
import
Feature
from
"ol/Feature"
;
import
Feature
from
"ol/Feature"
;
import
{
Icon
,
Style
,
Text
,
Fill
,
Stroke
}
from
"ol/style"
;
import
{
Icon
,
Style
,
Text
,
Fill
,
Stroke
}
from
"ol/style"
;
import
{
Vector
as
VectorLayer
}
from
"ol/layer"
;
import
{
Vector
as
VectorLayer
}
from
"ol/layer"
;
...
@@ -42,7 +42,8 @@ export default class Mutil {
...
@@ -42,7 +42,8 @@ export default class Mutil {
source
:
new
XYZ
({
source
:
new
XYZ
({
// url:
// url:
// "http://t{0-7}.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=c8df739f047ce17cfe41b63cbeae6997",
// "http://t{0-7}.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=c8df739f047ce17cfe41b63cbeae6997",
url
:
"https://t{0-7}.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=c8df739f047ce17cfe41b63cbeae6997"
,
//url: "https://t{0-7}.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=c8df739f047ce17cfe41b63cbeae6997",
url
:
"http://webst0{1-4}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}"
,
}),
}),
visible
:
true
,
visible
:
true
,
name
:
"天地图矢量底图影像"
,
name
:
"天地图矢量底图影像"
,
...
@@ -50,15 +51,17 @@ export default class Mutil {
...
@@ -50,15 +51,17 @@ export default class Mutil {
let
tianSlB
=
new
TileLayer
({
let
tianSlB
=
new
TileLayer
({
className
:
"mapTypeC"
,
className
:
"mapTypeC"
,
source
:
new
XYZ
({
source
:
new
XYZ
({
url
:
"https://t{0-7}.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=c8df739f047ce17cfe41b63cbeae6997"
,
//url: "https://t{0-7}.tianditu.gov.cn/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=c8df739f047ce17cfe41b63cbeae6997",
url
:
" http://wprd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=7"
,
}),
}),
visible
:
false
,
visible
:
false
,
name
:
"天地图标注"
,
name
:
"天地图标注
(不含路网)
"
,
});
});
let
tianSlC
=
new
TileLayer
({
let
tianSlC
=
new
TileLayer
({
className
:
"mapTypeC"
,
className
:
"mapTypeC"
,
source
:
new
XYZ
({
source
:
new
XYZ
({
url
:
"https://t{0-7}.tianditu.gov.cn/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=c8df739f047ce17cfe41b63cbeae6997"
,
//url: "https://t{0-7}.tianditu.gov.cn/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=c8df739f047ce17cfe41b63cbeae6997",
url
:
"http://webst0{1-4}.is.autonavi.com/appmaptile?style=8&x={x}&y={y}&z={z}"
,
}),
}),
visible
:
false
,
visible
:
false
,
name
:
"天地图标注"
,
name
:
"天地图标注"
,
...
@@ -285,20 +288,16 @@ export default class Mutil {
...
@@ -285,20 +288,16 @@ export default class Mutil {
this
.
MAP
.
getLayers
().
getArray
()[
0
].
setVisible
(
true
);
this
.
MAP
.
getLayers
().
getArray
()[
0
].
setVisible
(
true
);
this
.
MAP
.
getLayers
().
getArray
()[
1
].
setVisible
(
false
);
this
.
MAP
.
getLayers
().
getArray
()[
1
].
setVisible
(
false
);
this
.
MAP
.
getLayers
().
getArray
()[
2
].
setVisible
(
false
);
this
.
MAP
.
getLayers
().
getArray
()[
2
].
setVisible
(
false
);
console
.
log
(
this
.
MAP
.
getLayers
());
};
};
tianSlB
()
{
tianSlB
()
{
this
.
MAP
.
getLayers
().
getArray
()[
0
].
setVisible
(
false
);
this
.
MAP
.
getLayers
().
getArray
()[
0
].
setVisible
(
false
);
this
.
MAP
.
getLayers
().
getArray
()[
1
].
setVisible
(
true
);
this
.
MAP
.
getLayers
().
getArray
()[
1
].
setVisible
(
true
);
this
.
MAP
.
getLayers
().
getArray
()[
2
].
setVisible
(
false
);
this
.
MAP
.
getLayers
().
getArray
()[
2
].
setVisible
(
false
);
console
.
log
(
this
.
MAP
.
getLayers
());
};
};
tianSlC
()
{
tianSlC
()
{
this
.
MAP
.
getLayers
().
getArray
()[
0
].
setVisible
(
false
);
this
.
MAP
.
getLayers
().
getArray
()[
0
].
setVisible
(
false
);
this
.
MAP
.
getLayers
().
getArray
()[
1
].
setVisible
(
false
);
this
.
MAP
.
getLayers
().
getArray
()[
1
].
setVisible
(
false
);
this
.
MAP
.
getLayers
().
getArray
()[
2
].
setVisible
(
true
);
this
.
MAP
.
getLayers
().
getArray
()[
2
].
setVisible
(
true
);
console
.
log
(
this
.
MAP
.
getLayers
());
}
}
drawArea
(
json
)
{
drawArea
(
json
)
{
...
@@ -313,13 +312,6 @@ export default class Mutil {
...
@@ -313,13 +312,6 @@ export default class Mutil {
let
pos
=
fromLonLat
(
pArr
);
//将坐标转为默认投影,默认投影是EPSG:3857
let
pos
=
fromLonLat
(
pArr
);
//将坐标转为默认投影,默认投影是EPSG:3857
let
hdms
=
transform
(
pos
,
'EPSG:3857'
,
'EPSG:4326'
);
//坐标系间坐标转换,由前面的坐标转为后面坐标系坐标
let
hdms
=
transform
(
pos
,
'EPSG:3857'
,
'EPSG:4326'
);
//坐标系间坐标转换,由前面的坐标转为后面坐标系坐标
pointsz
.
push
(
pArr
)
//将转化格式后的点坐标存储起来
pointsz
.
push
(
pArr
)
//将转化格式后的点坐标存储起来
// for (let j = 0; j < pointArr.length - 1; j++) {
// let p = pointArr[j];
// let pArr = p.split(' ');
// let pos = fromLonLat(pArr); //将坐标转为默认投影,默认投影是EPSG:3857
// let hdms = transform(pos, 'EPSG:3857', 'EPSG:4326'); //坐标系间坐标转换,由前面的坐标转为后面坐标系坐标
// pointsz.push(pArr) //将转化格式后的点坐标存储起来
// }
};
};
//自己造的地图数据(GeoJSON数据)
//自己造的地图数据(GeoJSON数据)
let
geojsonObject
=
{
let
geojsonObject
=
{
...
@@ -328,18 +320,18 @@ export default class Mutil {
...
@@ -328,18 +320,18 @@ export default class Mutil {
'type'
:
'name'
,
'type'
:
'name'
,
'properties'
:
{
//特性
'properties'
:
{
//特性
'name'
:
'EPSG:3857'
'name'
:
'EPSG:3857'
}
,
}
'features'
:
[{
//要素
},
'type'
:
'Feature'
,
'features'
:
[{
//要素
'geometry'
:
{
//几何图形
'type'
:
'Feature'
,
'type'
:
'GeometryCollection'
,
//几何图形集合
'geometry'
:
{
//几何图形
'geometries'
:
[{
//几何形状
'type'
:
'GeometryCollection'
,
//几何图形集合
'type'
:
'Polygon'
,
//多边形
'geometries'
:
[{
//几何形状
'coordinates'
:
[
pointsz
]
//坐标
'type'
:
'Polygon'
,
//多边形
}]
'coordinates'
:
[
pointsz
]
//坐标
}
}]
}]
}
}
}]
};
};
let
vectorSource
=
new
VectorSource
({
//提供矢量图层的数据
let
vectorSource
=
new
VectorSource
({
//提供矢量图层的数据
features
:
(
new
GeoJSON
().
readFeatures
(
geojsonObject
))
features
:
(
new
GeoJSON
().
readFeatures
(
geojsonObject
))
...
@@ -365,27 +357,15 @@ export default class Mutil {
...
@@ -365,27 +357,15 @@ export default class Mutil {
}
}
changeCenter
(
name
)
{
//根据name传参
changeCenter
(
name
)
{
//根据name传参
console
.
log
(
"fdssffffffffffffffffffffffffffffffffffffffffffffffff"
)
axios
.
get
(
'https://restapi.amap.com/v3/config/district?key=cb087c0fb3b8bc56a4af064630495bb9&subdistrict=0&extensions=all&keywords='
+
name
).
then
(
res
=>
{
//调取天地图返回的数据
let
that
=
this
;
let
param
=
{};
param
.
serachWord
=
name
;
// param.serachType = '1'; //查询类型(0:根据code查询;1:根据名称)
// param.needSunInfo = 'false' ; //是否需要下一级信息
// param.needAll = 'false'; // 是否需要所有子节点(包括孙子节点)
// param.needPolygon = 'true'; //是否需要行政区划范围
// param.needPre = 'true'; //是否需要上一级所有信息
param
.
key
=
'cb087c0fb3b8bc56a4af064630495bb9'
;
//自己的天地图秘钥
axios
.
get
(
'https://restapi.amap.com/v3/config/district?key=cb087c0fb3b8bc56a4af064630495bb9&subdistrict=0&extensions=all&serachWord='
+
name
).
then
(
res
=>
{
// console.log(res.data[0])
let
local
=
res
.
data
.
districts
[
0
].
center
.
split
(
","
);
// let resData = res.data[0];
let
view
=
new
View
({
// let view = new View({
center
:
transform
(
fromLonLat
(
local
),
'EPSG:3857'
,
'EPSG:4326'
),
//将中心点坐标转为EPSG:4326
// center: transfrom(fromLonLat([resData.lnt,resData.lat]),'EPSG:3857','EPSG:4326'), //将中心点坐标转为EPSG:4326
projection
:
get
(
'EPSG:4326'
),
//投影坐标系 EPSG:4326
// projection: get('EPSG:4326'), //投影坐标系 EPSG:4326
zoom
:
10
// zoom: resData.level -1
});
// });
this
.
MAP
.
setView
(
view
);
//this.MAP.setView(view);
this
.
drawArea
(
res
.
data
.
districts
[
0
])
this
.
drawArea
(
res
.
data
.
districts
[
0
])
})
})
}
}
...
...
dcit-hcsystem-hcsystem-master/src/views/qyMap/qyMap.vue
View file @
366b1d5d
...
@@ -283,7 +283,6 @@ export default class GIS extends Vue {
...
@@ -283,7 +283,6 @@ export default class GIS extends Vue {
value
:
Number
(
obj
.
handleAlarmNum
),
value
:
Number
(
obj
.
handleAlarmNum
),
});
});
console
.
log
(
that
.
tjNumberObj
,
"tttttttttt"
);
// that.$nextTick(() => {
// that.$nextTick(() => {
// that.$set(that.config, "data", arr);
// that.$set(that.config, "data", arr);
// });
// });
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment