Browse Source

核查回转原始进入地图位置

wulanhaote
hbao 3 years ago
parent
commit
9672c87924
3 changed files with 89 additions and 38 deletions
  1. +9
    -0
      src/api/system/config.js
  2. +14
    -8
      src/components/Map/MapGisDrawing.vue
  3. +66
    -30
      src/views/homesteadSurvey/list.vue

+ 9
- 0
src/api/system/config.js View File

@@ -0,0 +1,9 @@
import request from '@/utils/request'

//查询geoserver服务地址
export function getGeoServerConfigKey() {
return request({
url: '/system/config/getGeoServerConfigKey',
method: 'get'
})
}

+ 14
- 8
src/components/Map/MapGisDrawing.vue View File

@@ -18,6 +18,7 @@

<script>
import {getQueryLand} from "@/api/homesteadSurvey/zjdzd";
import {getGeoServerConfigKey} from "@/api/system/config";
import $ from "jquery";

export default {
@@ -34,6 +35,8 @@ export default {
newZb: null,
newGeom: null,
mapData: null,
//地图服务地址
mapGeoServerUrl:"",
};
},
props: ['theGeom','message'],
@@ -69,6 +72,8 @@ export default {
//var hc_land;
var draw; // global so we can remove it later
var vector_drawing;
getGeoServerConfigKey().then(response => {
that.mapGeoServerUrl = response.msg;
if (that.message != null && that.message != ""
&& that.message != undefined) {
document.getElementById(that.uuidMap).innerHTML = '';
@@ -85,7 +90,7 @@ export default {

var aerial = new ol.layer.Tile({
source: new ol.source.XYZ({
url: "http://t0.tianditu.gov.cn/img_w/wmts?" +
url: "http://t{0-7}.tianditu.com/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=cc4aba6e967096098249efa069733067",
}),
@@ -95,7 +100,7 @@ export default {

var yingxzi = new ol.layer.Tile({
source: new ol.source.XYZ({
url: "https://t0.tianditu.gov.cn/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cc4aba6e967096098249efa069733067",
url: "http://t{0-7}.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cc4aba6e967096098249efa069733067",
}),
isGroup: true,
name: "天地图文字标注--卫星影像图",
@@ -118,7 +123,7 @@ export default {
var cql_filter_all = "dept_id='" + that.$cookies.get("item").deptId + "'";
var zjdTc= new ol.layer.Tile({
source: new ol.source.TileWMS({
url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
url: that.mapGeoServerUrl +"/geoserver/zjd_dc/wms",
params: {
LAYERS: 'zjd_dc:t_house_survey_zjdzd',
TILED: true,
@@ -463,7 +468,7 @@ export default {

var aerial = new ol.layer.Tile({
source: new ol.source.XYZ({
url: "http://t0.tianditu.gov.cn/img_w/wmts?" +
url: "http://t{0-7}.tianditu.com/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=cc4aba6e967096098249efa069733067",
}),
@@ -473,7 +478,7 @@ export default {

var yingxzi = new ol.layer.Tile({
source: new ol.source.XYZ({
url: "https://t0.tianditu.gov.cn/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cc4aba6e967096098249efa069733067",
url: "http://t{0-7}.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cc4aba6e967096098249efa069733067",
}),
isGroup: true,
name: "天地图文字标注--卫星影像图",
@@ -500,7 +505,7 @@ export default {
var cql_filter = "dept_id='" + that.$cookies.get("item").deptId + "'";
var cunTc= new ol.layer.Tile({
source: new ol.source.TileWMS({
url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
url: that.mapGeoServerUrl +"/geoserver/zjd_dc/wms",
params: {
LAYERS: 'zjd_dc:t_house_survey_border_village',
TILED: true,
@@ -523,7 +528,7 @@ export default {
outputFormat: "application/json",
//filter: ol.format.filter.equalTo(t,e,r)//前者是属性名,后者是对应值
};
let url_dw = "http://116.255.223.226:8080/geoserver/zjd_dc/wfs"; //wfsurl;
let url_dw = that.mapGeoServerUrl +"/geoserver/zjd_dc/wfs"; //wfsurl;
url_dw = url_dw + "?";
for (let key in param_dw) {
url_dw = url_dw + key + "=" + param_dw[key] + "&";
@@ -558,7 +563,7 @@ export default {
var cql_filter_all = "dept_id='" + that.$cookies.get("item").deptId + "'";
var zjdTc= new ol.layer.Tile({
source: new ol.source.TileWMS({
url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms",
params: {
LAYERS: 'zjd_dc:t_house_survey_zjdzd',
TILED: true,
@@ -742,6 +747,7 @@ export default {
//图层查询定位结束 ---------end
});
}
});
},
},
watch: {},


+ 66
- 30
src/views/homesteadSurvey/list.vue View File

@@ -1198,6 +1198,7 @@
import {listSuyqr,updateSuyqr,addSuyqr} from "@/api/homesteadSurvey/suyqr";
import {listZrz,getZrzZjdDmList,getZrz} from "@/api/homesteadSurvey/zrz";
import {listFsss,getFsssZjdDmList,getFsss} from "@/api/homesteadSurvey/fsss";
import {getGeoServerConfigKey} from "@/api/system/config";
import { listTown, getTown } from "@/api/homesteadSurvey/town";
import { listVillage} from "@/api/homesteadSurvey/village";
import $ from "jquery";
@@ -1364,7 +1365,10 @@
//地图跳转存之
mapAddJump:"",
mapAddJumpNum:"",
nhdm:""
nhdm:"",
backTheGeom:"",
//地图服务地址
mapGeoServerUrl:"",
};
},
mounted(){
@@ -1405,12 +1409,14 @@
this.getDicts("member_remark").then(response => {
this.cybzOptions = response.data;
});
console.log(this.$cookies.get("item"));
if(this.$cookies.get("item")){
if(this.$cookies.get("item").activeBtn !=null){
if(this.$cookies.get("item").activeBtn == 4){
this.activeBtn = this.$cookies.get("item").activeBtn;
this.item = this.$cookies.get("item").backMapZjdAData;
this.item = this.$cookies.get("item");
this.mapAddJump = this.$cookies.get("item").backMapZjdAData.deptId;
this.backTheGeom = this.$cookies.get("item").backMapZjdAData.theGeom;
this.mapAddJumpNum =1;
this.mapShow();
this.getZjdList();
@@ -2288,9 +2294,12 @@
// }
// });
//通过数据直接查询方式--------加载较慢 end
setTimeout(() => {
this.GetMapsInit();
}, 300);
getGeoServerConfigKey().then(response => {
this.mapGeoServerUrl = response.msg;
setTimeout(() => {
this.GetMapsInit();
}, 300);
});
var that = this;
setTimeout(function () {
var height = $(".searchBar_wrap").outerHeight(true) - $(".searchBar_wrap .van-search").outerHeight(true)
@@ -2316,7 +2325,10 @@

var aerial = new ol.layer.Tile({
source: new ol.source.XYZ({
url: "http://t0.tianditu.gov.cn/img_w/wmts?" +
// url: "http://t0.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=cc4aba6e967096098249efa069733067",
url: "http://t{0-7}.tianditu.com/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=cc4aba6e967096098249efa069733067",
}),
@@ -2326,7 +2338,7 @@

var yingxzi = new ol.layer.Tile({
source: new ol.source.XYZ({
url: "https://t0.tianditu.gov.cn/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cc4aba6e967096098249efa069733067",
url: "http://t{0-7}.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cc4aba6e967096098249efa069733067",
}),
isGroup: true,
name: "天地图文字标注--卫星影像图",
@@ -2354,7 +2366,7 @@
//镇边界查询开始 ------------------------------start
// var zhenTc= new ol.layer.Tile({
// source: new ol.source.TileWMS({
// url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
// url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms",
// params: {
// LAYERS: 'zjd_dc:t_house_survey_border_town',
// TILED: true,
@@ -2374,7 +2386,7 @@
}
var cunTc= new ol.layer.Tile({
source: new ol.source.TileWMS({
url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms",
params: {
LAYERS: 'zjd_dc:t_house_survey_border_village',
TILED: true,
@@ -2397,7 +2409,7 @@
outputFormat: "application/json",
//filter: ol.format.filter.equalTo(t,e,r)//前者是属性名,后者是对应值
};
let url_dw = "http://116.255.223.226:8080/geoserver/zjd_dc/wfs"; //wfsurl;
let url_dw = that.mapGeoServerUrl+"/geoserver/zjd_dc/wfs"; //wfsurl;
url_dw = url_dw + "?";
for (let key in param_dw) {
url_dw = url_dw + key + "=" + param_dw[key] + "&";
@@ -2411,16 +2423,40 @@
return geojsonmap;
})
.then((data) => {
let resolution = map.getView().getResolutionForExtent(data.bbox,map.getSize());
map.getView().fit(data.bbox);
map.getView().setResolution(resolution);
// var datamap = data.bbox;
// var center = ol.extent.getCenter(datamap);
// map.getView().animate({
// // 只设置需要的属性即可
// center: center, // 中心点
// rotation: undefined, // 缩放完成view视图旋转弧度
// });
if(that.backTheGeom !="" && that.backTheGeom !=undefined){
hc_land_on = new ol.layer.Vector({
title: "add Layer",
source: new ol.source.Vector({
projection: projection,
features: new ol.format.GeoJSON().readFeatures(that.backTheGeom),
}),
style: new ol.style.Style({
stroke: new ol.style.Stroke({
//边界样式
color: "#CCFF66",
width: 6,
}),
}),
});
map.addLayer(hc_land_on);
var maxXMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxX;
var maxYMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxY;
var minXMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.minX;
var minYMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.minY;
//定位查询位置
var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置
map.getView().animate({
// 只设置需要的属性即可
center: center, // 中心点
zoom: 17.9, // 缩放级别
rotation: undefined, // 缩放完成view视图旋转弧度
duration: 1000, // 缩放持续时间,默认不需要设置
});
}else {
let resolution = map.getView().getResolutionForExtent(data.bbox,map.getSize());
map.getView().fit(data.bbox);
map.getView().setResolution(resolution);
}
})
.catch((error) => {
console.log("【异常】", error);
@@ -2431,7 +2467,7 @@
//var cql_filter_all = "dept_id='" + that.$cookies.get("item").deptId + "'";
var zjdTc= new ol.layer.Tile({
source: new ol.source.TileWMS({
url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms",
params: {
LAYERS: 'zjd_dc:t_house_survey_zjdzd',
TILED: true,
@@ -2446,7 +2482,7 @@
//自然幢图层查询开始 ------------------start
var zrzTc= new ol.layer.Tile({
source: new ol.source.TileWMS({
url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms",
params: {
LAYERS: 'zjd_dc:t_house_survey_zrz',
TILED: true,
@@ -2461,7 +2497,7 @@
//附属设施图层查询开始 ------------------start
var fsssTc= new ol.layer.Tile({
source: new ol.source.TileWMS({
url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms",
params: {
LAYERS: 'zjd_dc:t_house_survey_fsss',
TILED: true,
@@ -3121,7 +3157,7 @@
// //业务图层 wms服务
// delete_map[i] = new ol.layer.Tile({
// source: new ol.source.TileWMS({
// url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
// url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms",
// params: {
// LAYERS: difang[i],
// //'LAYERS': 'new_shp:new_shp_all',
@@ -3147,7 +3183,7 @@
// outputFormat: "application/json",
// //filter: ol.format.filter.equalTo(t,e,r)//前者是属性名,后者是对应值
// };
// let url_dw = "http://116.255.223.226:8080/geoserver/zjd_dc/wfs"; //wfsurl;
// let url_dw = that.mapGeoServerUrl+"/geoserver/zjd_dc/wfs"; //wfsurl;
// url_dw = url_dw + "?";
// for (let key in param_dw) {
// url_dw = url_dw + key + "=" + param_dw[key] + "&";
@@ -3705,7 +3741,7 @@
outputFormat: "application/json",
//filter: ol.format.filter.equalTo(t,e,r)//前者是属性名,后者是对应值
};
let url_dw = "http://116.255.223.226:8080/geoserver/zjd_dc/wfs"; //wfsurl;
let url_dw = that.mapGeoServerUrl+"/geoserver/zjd_dc/wfs"; //wfsurl;
url_dw = url_dw + "?";
for (let key in param_dw) {
url_dw = url_dw + key + "=" + param_dw[key] + "&";
@@ -3747,7 +3783,7 @@

//查询全部图层 -------查询叠加图层出现覆盖问题
var wmsSource = new ol.source.TileWMS({
url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms",
params: {
LAYERS: "zjd_dc:t_house_survey_all",
TILED: true,
@@ -3759,7 +3795,7 @@

//查询宅基地图层
var ZjdwmsSource = new ol.source.TileWMS({
url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms",
params: {
LAYERS: "zjd_dc:t_house_survey_zjdzd",
TILED: true,
@@ -3771,7 +3807,7 @@

//查询自然幢图层
var ZrzwmsSource = new ol.source.TileWMS({
url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms",
params: {
LAYERS: "zjd_dc:t_house_survey_zrz",
TILED: true,
@@ -3783,7 +3819,7 @@

//查询附属设施图层
var FssswmsSource = new ol.source.TileWMS({
url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
url: that.mapGeoServerUrl+"/geoserver/zjd_dc/wms",
params: {
LAYERS: "zjd_dc:t_house_survey_fsss",
TILED: true,


Loading…
Cancel
Save