Browse Source

隐藏区域线,道路重新绘制,加一个绘制道路的说明

master
mk 1 year ago
parent
commit
bce33b0a96
  1. 75
      README.md
  2. 7426
      src/views/next/screen-content-map/cpt/aaa.json
  3. 5221
      src/views/next/screen-content-map/cpt/daolu.json
  4. 6733
      src/views/next/screen-content-map/cpt/daolu1.js
  5. 7
      src/views/next/screen-content-map/cpt/zdyf-map.vue

75
README.md

@ -22,3 +22,78 @@ npm run lint
### Customize configuration ### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/). See [Configuration Reference](https://cli.vuejs.org/config/).
### 画路高德页面
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<style>
html,
body,
#container {
width: 100%;
height: 100%;
}
#panel {
position: fixed;
background-color: white;
max-height: 90%;
overflow-y: auto;
top: 10px;
right: 10px;
width: 280px;
}
#panel .amap-call {
background-color: #009cf9;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
#panel .amap-lib-driving {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
overflow: hidden;
}
</style>
<title>位置经纬度 + 获取驾车规划数据</title>
<link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css" />
<script src="https://webapi.amap.com/maps?v=1.4.15&key=您申请的key值&plugin=AMap.Driving"></script>
<script src="https://a.amap.com/jsapi_demos/static/demo-center/js/demoutils.js"></script>
</head>
<body>
<div id="container"></div>
<div id="panel"></div>
<script type="text/javascript">
var map = new AMap.Map("container", {
center: [116.397559, 39.89621],
zoom: 14
});
var drivingOption = {
policy: AMap.DrivingPolicy.LEAST_TIME, // 其它policy参数请参考 https://lbs.amap.com/api/javascript-api/reference/route-search#m_DrivingPolicy
ferry: 1, // 是否可以使用轮渡
province: '京', // 车牌省份的汉字缩写
map: map,
panel: 'panel'
}
// 构造路线导航类
var driving = new AMap.Driving(drivingOption)
// 根据起终点经纬度规划驾车导航路线
driving.search(new AMap.LngLat(120.168948,36.498816), new AMap.LngLat(120.190341,36.502635), function(status, result) {
// result 即是对应的驾车导航信息,相关数据结构文档请参考 https://lbs.amap.com/api/javascript-api/reference/route-search#m_DrivingResult
if (status === 'complete') {
console.log(JSON.stringify(result.routes[0].steps));
log.success('绘制驾车路线完成')
} else {
log.error('获取驾车数据失败:' + result)
}
});
</script>
</body>
</html>
### 它会在控制台返回一些数据把它全复制下来>https://www.sojson.com/simple_json.html 到这里把它转成JSON格式>到daolu1.js把它粘贴进去>然后到控制台去执行它会返回一写些标>在daolu.json中加一个对象把coordinates替换成坐标

7426
src/views/next/screen-content-map/cpt/aaa.json

File diff suppressed because it is too large

5221
src/views/next/screen-content-map/cpt/daolu.json

File diff suppressed because it is too large

6733
src/views/next/screen-content-map/cpt/daolu1.js

File diff suppressed because it is too large

7
src/views/next/screen-content-map/cpt/zdyf-map.vue

@ -1,3 +1,4 @@
<template> <template>
<div style="width: 100%; height: 100%"> <div style="width: 100%; height: 100%">
<div class="bg_img" v-if="mapFlag == 'Emap'"> <div class="bg_img" v-if="mapFlag == 'Emap'">
@ -297,7 +298,7 @@ export default {
duration: 2, // duration: 2, //
trailLength: 2 // 线 trailLength: 2 // 线
}) })
scene.addLayer(lineLayer) // scene.addLayer(lineLayer)
lineLayer1 = new LineLayer({ lineLayer1 = new LineLayer({
zIndex: 2, zIndex: 2,
name: 'line3' name: 'line3'
@ -379,6 +380,10 @@ export default {
dotLayer.on('click', (e) => { dotLayer.on('click', (e) => {
this.openCompanyDetail(e.feature.properties) this.openCompanyDetail(e.feature.properties)
}) })
polygonLayer.on('click', (e) => {
let {lng,lat} = e.lngLat
console.log(`${lng},${lat}`,'拾取的边界点');
})
dotLayer1.on('click', (e) => { dotLayer1.on('click', (e) => {
this.openCompanyDetail(e.feature.properties) this.openCompanyDetail(e.feature.properties)
}) })

Loading…
Cancel
Save