This commit is contained in:
parent
6a7d268a79
commit
778231a530
|
@ -0,0 +1,66 @@
|
|||
var x_PI = 3.14159265358979324 * 3000.0 / 180.0;
|
||||
var PI = 3.1415926535897932384626;
|
||||
var a = 6378245.0;
|
||||
var ee = 0.00669342162296594323;
|
||||
function gcj02towgs84(lng, lat) {
|
||||
var lat = +lat;
|
||||
var lng = +lng;
|
||||
if (out_of_china(lng, lat)) {
|
||||
return [lng, lat]
|
||||
} else {
|
||||
var dlat = transformlat(lng - 105.0, lat - 35.0);
|
||||
var dlng = transformlng(lng - 105.0, lat - 35.0);
|
||||
var radlat = lat / 180.0 * PI;
|
||||
var magic = Math.sin(radlat);
|
||||
magic = 1 - ee * magic * magic;
|
||||
var sqrtmagic = Math.sqrt(magic);
|
||||
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
|
||||
dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
|
||||
var mglat = lat + dlat;
|
||||
var mglng = lng + dlng;
|
||||
return [lng * 2 - mglng, lat * 2 - mglat]
|
||||
}
|
||||
};
|
||||
function out_of_china(lng, lat) {
|
||||
var lat = +lat;
|
||||
var lng = +lng;
|
||||
// 纬度3.86~53.55,经度73.66~135.05
|
||||
return !(lng > 73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55);
|
||||
};
|
||||
function transformlat(lng, lat) {
|
||||
var lat = +lat;
|
||||
var lng = +lng;
|
||||
var ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
|
||||
ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
|
||||
ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0;
|
||||
ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0;
|
||||
return ret
|
||||
};
|
||||
function transformlng(lng, lat) {
|
||||
var lat = +lat;
|
||||
var lng = +lng;
|
||||
var ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
|
||||
ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
|
||||
ret += (20.0 * Math.sin(lng * PI) + 40.0 * Math.sin(lng / 3.0 * PI)) * 2.0 / 3.0;
|
||||
ret += (150.0 * Math.sin(lng / 12.0 * PI) + 300.0 * Math.sin(lng / 30.0 * PI)) * 2.0 / 3.0;
|
||||
return ret
|
||||
};
|
||||
function latLng2WebMercator(lng, lat) {
|
||||
var earthRad = 6378137.0;
|
||||
var x = lng * Math.PI / 180 * earthRad;
|
||||
var a = lat * Math.PI / 180;
|
||||
var y = earthRad / 2 * Math.log((1.0 + Math.sin(a)) / (1.0 - Math.sin(a)));
|
||||
return [x, y]; //[12727039.383734727, 3579066.6894065146]
|
||||
}
|
||||
function wgs84utmToGCJ02() {
|
||||
var retransformX = document.getElementById("retransformX");
|
||||
var retransformY = document.getElementById("retransformY");
|
||||
var transformX = document.getElementById("transformX");
|
||||
var transformY = document.getElementById("transformY");
|
||||
var g84 = gcj02towgs84(Number(retransformX.value), Number(retransformY.value))
|
||||
var mer = latLng2WebMercator(g84[0], g84[1])
|
||||
transformX.value = mer[0];
|
||||
transformY.value = mer[1];
|
||||
|
||||
}
|
||||
export default gcj02towgs84;
|
|
@ -154,6 +154,12 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btns">
|
||||
<div class="btnopen" @click="openEdit">编辑</div>
|
||||
<div class="btnsave">保存</div>
|
||||
<div class="btnclose" @click="closeEdit">取消</div>
|
||||
</div>
|
||||
|
||||
<Dialog
|
||||
:dialogShow="dialogShow"
|
||||
:columns="tableType.columns"
|
||||
|
@ -255,6 +261,7 @@ import xcbg from "@/assets/images/map/xcbg.png";
|
|||
import AED from "@/assets/images/map/AED.png";
|
||||
import Dialog from "./dialog/dialogMapDp.vue";
|
||||
import personDetail from "./person/index.vue";
|
||||
import gcj02towgs84 from "@/utils/gcj02towgs84.js";
|
||||
//--------定义参数-------
|
||||
//加载
|
||||
const loadingss = ref(false);
|
||||
|
@ -796,6 +803,20 @@ const initMap = () => {
|
|||
//添加街道名
|
||||
addJd();
|
||||
};
|
||||
|
||||
//开启编辑
|
||||
const openEdit = () => {
|
||||
console.log(cs_choose_arr.value[0]);
|
||||
cs_choose_arr.value[0].enableEditing();
|
||||
|
||||
// let a=gcj02towgs84(13275212.822414309,3334688.527092757)
|
||||
// console.log(a);
|
||||
};
|
||||
//关闭编辑
|
||||
const closeEdit = () => {
|
||||
cs_choose_arr.value[0].disableEditing();
|
||||
console.log(cs_choose_arr.value[0]);
|
||||
};
|
||||
//点击龙游县初始化
|
||||
const csh = () => {
|
||||
clear();
|
||||
|
@ -2252,7 +2273,7 @@ const addPolygonCounty = () => {
|
|||
map.clearOverlays();
|
||||
let fillColor = "#ffffff";
|
||||
mapTownDataDK.map((item) => {
|
||||
item.leg = 0;
|
||||
// item.leg = 0;
|
||||
//地区的坐标范围
|
||||
let points = [];
|
||||
item.point.map((p) => points.push(new BMapGL.Point(...p)));
|
||||
|
@ -2503,7 +2524,6 @@ const loadCs = (name) => {
|
|||
};
|
||||
//添加村社区块
|
||||
const addPolygonCountyCs = () => {
|
||||
// console.log(11111111111111, xkzDk);
|
||||
xkzDk.map((item, index) => {
|
||||
let num = index % 9;
|
||||
let fillColor = colorList[num].bg;
|
||||
|
@ -2985,7 +3005,7 @@ const reset_font2 = () => {
|
|||
"scale(" + width / 1920 + "," + height / 1080 + ")";
|
||||
};
|
||||
onMounted(async () => {
|
||||
// tools.data.set("token", "6b0e380b4a8f46baae4923f83faf670d");
|
||||
tools.data.set("token", "6b0e380b4a8f46baae4923f83faf670d");
|
||||
loadingss.value = true;
|
||||
reset_font();
|
||||
initMap();
|
||||
|
@ -3559,7 +3579,14 @@ onMounted(async () => {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btns {
|
||||
z-index: 999;
|
||||
position: absolute;
|
||||
color: #ffffff;
|
||||
top: 80px;
|
||||
left: 600px;
|
||||
display: flex;
|
||||
}
|
||||
.title {
|
||||
background-image: url(@/assets/images/map/map_title_bg.png);
|
||||
background-repeat: no-repeat;
|
||||
|
|
|
@ -15,8 +15,8 @@ export default defineConfig({
|
|||
// 第一个代理
|
||||
"/api": {
|
||||
// 匹配到啥来进行方向代理
|
||||
target: "http://10.0.0.65:8095/", //刘进
|
||||
// target: "http://220.191.238.50:996/", //线上
|
||||
// target: "http://10.0.0.65:8095/", //刘进
|
||||
target: "http://220.191.238.50:996/", //线上
|
||||
changeOrigin: true, //是否支持跨域
|
||||
//rewrite: (path) => path.replace(/^\/api/, '') // 如果不需要api 直接把路径上的api 替换成空,这个
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue