|
@@ -1599,18 +1599,28 @@ export default { |
|
|
if (res.code == 200) { |
|
|
if (res.code == 200) { |
|
|
let content = res.data; |
|
|
let content = res.data; |
|
|
this.hcAreaInfoOption = content; |
|
|
this.hcAreaInfoOption = content; |
|
|
let currDeptId = "169"; |
|
|
|
|
|
// if(content[0].children && content[0].children.length!=0){ |
|
|
|
|
|
// if(content[0].children[0].children && content[0].children[0].children.length!=0){ |
|
|
|
|
|
// if(content[0].children[0].children[0].children && content[0].children[0].children[0].children.length!=0){ |
|
|
|
|
|
// currDeptId = content[0].children[0].children[0].children[0].value; |
|
|
|
|
|
// } |
|
|
|
|
|
// }else{ |
|
|
|
|
|
// currDeptId = content[0].children[0].value |
|
|
|
|
|
// } |
|
|
|
|
|
// }else{ |
|
|
|
|
|
// currDeptId = content[0].value |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
let currDeptId; // = "169"; |
|
|
|
|
|
if (content[0].children && content[0].children.length != 0) { |
|
|
|
|
|
if ( |
|
|
|
|
|
content[0].children[0].children && |
|
|
|
|
|
content[0].children[0].children.length != 0 |
|
|
|
|
|
) { |
|
|
|
|
|
if ( |
|
|
|
|
|
content[0].children[0].children[0].children && |
|
|
|
|
|
content[0].children[0].children[0].children.length != 0 |
|
|
|
|
|
) { |
|
|
|
|
|
currDeptId = |
|
|
|
|
|
content[0].children[0].children[0].children[0].value; |
|
|
|
|
|
} else { |
|
|
|
|
|
currDeptId = content[0].children[0].children[0].value; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
currDeptId = content[0].children[0].value; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
currDeptId = content[0].value; |
|
|
|
|
|
} |
|
|
|
|
|
// console.log(currDeptId); |
|
|
//获取村详细信息 |
|
|
//获取村详细信息 |
|
|
this.deptGetFun(currDeptId); |
|
|
this.deptGetFun(currDeptId); |
|
|
//获取地图 |
|
|
//获取地图 |
|
@@ -2107,7 +2117,7 @@ export default { |
|
|
//属性查询结束 ------------------end |
|
|
//属性查询结束 ------------------end |
|
|
|
|
|
|
|
|
//按照分类查询 村定位地图-----------------start |
|
|
//按照分类查询 村定位地图-----------------start |
|
|
var nongZt = ["house","land"]; |
|
|
|
|
|
|
|
|
var nongZt = ["house", "land"]; |
|
|
var texiao_layer_fang; |
|
|
var texiao_layer_fang; |
|
|
var texiao_layer_di; |
|
|
var texiao_layer_di; |
|
|
$("#cun").on("change", function () { |
|
|
$("#cun").on("change", function () { |
|
@@ -2150,75 +2160,74 @@ export default { |
|
|
|
|
|
|
|
|
//图层加载 |
|
|
//图层加载 |
|
|
//地的数据判断 |
|
|
//地的数据判断 |
|
|
var difang = ["nsgk_hc:t_geo_hc_house","nsgk_hc:t_geo_hc_land"]; |
|
|
|
|
|
|
|
|
var difang = ["nsgk_hc:t_geo_hc_house", "nsgk_hc:t_geo_hc_land"]; |
|
|
console.log("++++++++++++" + cun); |
|
|
console.log("++++++++++++" + cun); |
|
|
//业务图层 wms服务 |
|
|
//业务图层 wms服务 |
|
|
for (var i = 0; i < difang.length; i++) { |
|
|
for (var i = 0; i < difang.length; i++) { |
|
|
if (difang[i] == "nsgk_hc:t_geo_hc_house") { |
|
|
|
|
|
cql_filter = "CM='" + cun + "'"; |
|
|
|
|
|
} else { |
|
|
|
|
|
cql_filter = "CM='" + cun + "'"; |
|
|
|
|
|
} |
|
|
|
|
|
nongZt[i] = new ol.layer.Tile({ |
|
|
|
|
|
source: new ol.source.TileWMS({ |
|
|
|
|
|
//url: 'http://192.168.31.150:8888/geoserver/mywork_mysql/wms', |
|
|
|
|
|
url: "http://116.255.135.38:8080/geoserver/nsgk_hc/wms", |
|
|
|
|
|
//url: 'http://localhost:8888/geoserver/mywork_mysql/wms', |
|
|
|
|
|
//url: 'http://localhost:8888/geoserver/new_shp/wms', |
|
|
|
|
|
params: { |
|
|
|
|
|
LAYERS: difang[i], |
|
|
|
|
|
//'LAYERS': 'new_shp:new_shp_all', |
|
|
|
|
|
TILED: true, |
|
|
|
|
|
cql_filter: cql_filter, |
|
|
|
|
|
SRID: 3857, |
|
|
|
|
|
}, |
|
|
|
|
|
}), |
|
|
|
|
|
}); |
|
|
|
|
|
//} |
|
|
|
|
|
//定位查询位置 |
|
|
|
|
|
let param_dw = { |
|
|
|
|
|
srsName: "EPSG:3857", |
|
|
|
|
|
service: "WFS", |
|
|
|
|
|
version: "1.0.0", |
|
|
|
|
|
request: "GetFeature", |
|
|
|
|
|
typename: difang[i], |
|
|
|
|
|
//featureNS: 'nsgk_hc',//命名空间 URI |
|
|
|
|
|
cql_filter: cql_filter, |
|
|
|
|
|
//featurePrefix: 'nationalwater',//工作区名称 |
|
|
|
|
|
//featureTypes: ['nationalwater:01fir'],//查询图层,可以是同一个工作区下多个图层,逗号隔开 |
|
|
|
|
|
outputFormat: "application/json", |
|
|
|
|
|
//filter: ol.format.filter.equalTo(t,e,r)//前者是属性名,后者是对应值 |
|
|
|
|
|
}; |
|
|
|
|
|
let url_dw = "http://116.255.135.38:8080/geoserver/nsgk_hc/wfs"; //wfsurl; |
|
|
|
|
|
url_dw = url_dw + "?"; |
|
|
|
|
|
for (let key in param_dw) { |
|
|
|
|
|
url_dw = url_dw + key + "=" + param_dw[key] + "&"; |
|
|
|
|
|
} |
|
|
|
|
|
url_dw = url_dw.substr(0, url_dw.length - 1); |
|
|
|
|
|
console.log(url_dw); |
|
|
|
|
|
fetch(url_dw, { |
|
|
|
|
|
method: "POST", // *GET, POST, PUT, DELETE, etc. |
|
|
|
|
|
}) |
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
var geojsonmap = res.json(); |
|
|
|
|
|
return geojsonmap; |
|
|
|
|
|
}) |
|
|
|
|
|
.then((data) => { |
|
|
|
|
|
//var datamap = data.bbox; |
|
|
|
|
|
// var datamap = data.features[0].bbox; |
|
|
|
|
|
// map.getView().animate({ |
|
|
|
|
|
// // 只设置需要的属性即可 |
|
|
|
|
|
// center: datamap, // 中心点 |
|
|
|
|
|
// zoom: 15, // 缩放级别 |
|
|
|
|
|
// rotation: undefined, // 缩放完成view视图旋转弧度 |
|
|
|
|
|
// duration: 1000, // 缩放持续时间,默认不需要设置 |
|
|
|
|
|
// }); |
|
|
|
|
|
}) |
|
|
|
|
|
.catch((error) => { |
|
|
|
|
|
console.log("【异常】", error); |
|
|
|
|
|
|
|
|
if (difang[i] == "nsgk_hc:t_geo_hc_house") { |
|
|
|
|
|
cql_filter = "CM='" + cun + "'"; |
|
|
|
|
|
} else { |
|
|
|
|
|
cql_filter = "CM='" + cun + "'"; |
|
|
|
|
|
} |
|
|
|
|
|
nongZt[i] = new ol.layer.Tile({ |
|
|
|
|
|
source: new ol.source.TileWMS({ |
|
|
|
|
|
//url: 'http://192.168.31.150:8888/geoserver/mywork_mysql/wms', |
|
|
|
|
|
url: "http://116.255.135.38:8080/geoserver/nsgk_hc/wms", |
|
|
|
|
|
//url: 'http://localhost:8888/geoserver/mywork_mysql/wms', |
|
|
|
|
|
//url: 'http://localhost:8888/geoserver/new_shp/wms', |
|
|
|
|
|
params: { |
|
|
|
|
|
LAYERS: difang[i], |
|
|
|
|
|
//'LAYERS': 'new_shp:new_shp_all', |
|
|
|
|
|
TILED: true, |
|
|
|
|
|
cql_filter: cql_filter, |
|
|
|
|
|
SRID: 3857, |
|
|
|
|
|
}, |
|
|
|
|
|
}), |
|
|
}); |
|
|
}); |
|
|
map.addLayer(nongZt[i]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//} |
|
|
|
|
|
//定位查询位置 |
|
|
|
|
|
let param_dw = { |
|
|
|
|
|
srsName: "EPSG:3857", |
|
|
|
|
|
service: "WFS", |
|
|
|
|
|
version: "1.0.0", |
|
|
|
|
|
request: "GetFeature", |
|
|
|
|
|
typename: difang[i], |
|
|
|
|
|
//featureNS: 'nsgk_hc',//命名空间 URI |
|
|
|
|
|
cql_filter: cql_filter, |
|
|
|
|
|
//featurePrefix: 'nationalwater',//工作区名称 |
|
|
|
|
|
//featureTypes: ['nationalwater:01fir'],//查询图层,可以是同一个工作区下多个图层,逗号隔开 |
|
|
|
|
|
outputFormat: "application/json", |
|
|
|
|
|
//filter: ol.format.filter.equalTo(t,e,r)//前者是属性名,后者是对应值 |
|
|
|
|
|
}; |
|
|
|
|
|
let url_dw = "http://116.255.135.38:8080/geoserver/nsgk_hc/wfs"; //wfsurl; |
|
|
|
|
|
url_dw = url_dw + "?"; |
|
|
|
|
|
for (let key in param_dw) { |
|
|
|
|
|
url_dw = url_dw + key + "=" + param_dw[key] + "&"; |
|
|
|
|
|
} |
|
|
|
|
|
url_dw = url_dw.substr(0, url_dw.length - 1); |
|
|
|
|
|
console.log(url_dw); |
|
|
|
|
|
fetch(url_dw, { |
|
|
|
|
|
method: "POST", // *GET, POST, PUT, DELETE, etc. |
|
|
|
|
|
}) |
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
var geojsonmap = res.json(); |
|
|
|
|
|
return geojsonmap; |
|
|
|
|
|
}) |
|
|
|
|
|
.then((data) => { |
|
|
|
|
|
//var datamap = data.bbox; |
|
|
|
|
|
// var datamap = data.features[0].bbox; |
|
|
|
|
|
// map.getView().animate({ |
|
|
|
|
|
// // 只设置需要的属性即可 |
|
|
|
|
|
// center: datamap, // 中心点 |
|
|
|
|
|
// zoom: 15, // 缩放级别 |
|
|
|
|
|
// rotation: undefined, // 缩放完成view视图旋转弧度 |
|
|
|
|
|
// duration: 1000, // 缩放持续时间,默认不需要设置 |
|
|
|
|
|
// }); |
|
|
|
|
|
}) |
|
|
|
|
|
.catch((error) => { |
|
|
|
|
|
console.log("【异常】", error); |
|
|
|
|
|
}); |
|
|
|
|
|
map.addLayer(nongZt[i]); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
//村定位查询-------------------------------------end |
|
|
//村定位查询-------------------------------------end |
|
|