|
@@ -57,30 +57,30 @@ export default {
|
|
/**
|
|
/**
|
|
* 获取街镇信息
|
|
* 获取街镇信息
|
|
*/
|
|
*/
|
|
- var options = {
|
|
|
|
- click: addLayerCallBack,
|
|
|
|
- isZoom: false,
|
|
|
|
- style: {
|
|
|
|
- outline: true,
|
|
|
|
- outlineColor: "rgb(255,0,0,0.8)",
|
|
|
|
- material: "rgb(154,255,154,0)",
|
|
|
|
- perPositionHeight: false,
|
|
|
|
- height: 5,
|
|
|
|
- width: 5,
|
|
|
|
- label: {
|
|
|
|
- show: true,
|
|
|
|
- text: "name",
|
|
|
|
- font: "16px Helvetica",
|
|
|
|
- fillColor: "rgb(0,255,0,0.9)",
|
|
|
|
- pixelOffset: [0, -40],
|
|
|
|
- backgroundColor: "rgb(0,0,0,0)",
|
|
|
|
- showBackground: false,
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- // where:"name = '莘庄镇'"
|
|
|
|
- };
|
|
|
|
|
|
+ // var options = {
|
|
|
|
+ // click: addLayerCallBack,
|
|
|
|
+ // isZoom: false,
|
|
|
|
+ // style: {
|
|
|
|
+ // outline: true,
|
|
|
|
+ // outlineColor: "rgb(255,0,0,0.8)",
|
|
|
|
+ // material: "rgb(154,255,154,0)",
|
|
|
|
+ // perPositionHeight: false,
|
|
|
|
+ // height: 5,
|
|
|
|
+ // width: 5,
|
|
|
|
+ // label: {
|
|
|
|
+ // show: true,
|
|
|
|
+ // text: "name",
|
|
|
|
+ // font: "16px Helvetica",
|
|
|
|
+ // fillColor: "rgb(0,255,0,0.9)",
|
|
|
|
+ // pixelOffset: [0, -40],
|
|
|
|
+ // backgroundColor: "rgb(0,0,0,0)",
|
|
|
|
+ // showBackground: false,
|
|
|
|
+ // },
|
|
|
|
+ // },
|
|
|
|
+ // // where:"name = '莘庄镇'"
|
|
|
|
+ // };
|
|
|
|
|
|
- window.jMap.addLayer("mh_dyn_district", [1], options);
|
|
|
|
|
|
+ // window.jMap.addLayer("mh_dyn_district", [1], options);
|
|
var _this = this;
|
|
var _this = this;
|
|
|
|
|
|
function addLayerCallBack(obj) {
|
|
function addLayerCallBack(obj) {
|
|
@@ -89,6 +89,9 @@ export default {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
//区域采集
|
|
//区域采集
|
|
// var options1 = {
|
|
// var options1 = {
|
|
// callBack: pickPolygonCallBack
|
|
// callBack: pickPolygonCallBack
|
|
@@ -102,95 +105,190 @@ export default {
|
|
|
|
|
|
|
|
|
|
// 图层查询
|
|
// 图层查询
|
|
|
|
+ //例:8.1 2查询图层列表
|
|
|
|
+ // var JmapQuery = new JMapQuery(window.jMap); // JMap为初始化地图时,实例化的JMap对象
|
|
|
|
+
|
|
|
|
+ // var qp2 = new JMapQueryParam({
|
|
|
|
+ // queryMapService: "mh_dyn_district",
|
|
|
|
+ // queryMapLayers: [1],
|
|
|
|
+ // // queryGeometry: result[0], // 默认进行属性查询,放开该段注释将在选定的几何空间内进行空间查询
|
|
|
|
+ // // queryWhere: "name like '%莘庄镇%' ", // 可自定义查询条件,也可不传该参数
|
|
|
|
+ // outFields: ["*"], // 返回字段信息
|
|
|
|
+ // callBack: testQueryCallBack
|
|
|
|
+ // });
|
|
|
|
+ // JmapQuery.execQuery(qp2);
|
|
|
|
+ // // 图层查询完毕的回调函数
|
|
|
|
+ // function testQueryCallBack(obj) {
|
|
|
|
+ // var bigArr = obj.features;
|
|
|
|
+ // var bigNewArr = []
|
|
|
|
+ // bigArr.forEach(function(item, index) {
|
|
|
|
+ // var aaa = item.geometry.rings[0];
|
|
|
|
+ // var newArr = aaa.map(function(value, index) {
|
|
|
|
+ // var obj = {
|
|
|
|
+ // x: value[0],
|
|
|
|
+ // y: value[1],
|
|
|
|
+ // z: 0.1
|
|
|
|
+ // }
|
|
|
|
+ // return obj
|
|
|
|
+ // })
|
|
|
|
+ // bigNewArr.push(newArr)
|
|
|
|
+
|
|
|
|
+ // })
|
|
|
|
+ // let arrayAll = [];
|
|
|
|
+ // bigNewArr.forEach(function(item, index) {
|
|
|
|
+ // var idx = index + 1;
|
|
|
|
+ // console.log(idx)
|
|
|
|
+ // var color = ["#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", "#009b8a", "#b72727", "#71a382", "#1c6093", "#a4294f", "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", ];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
+ // console.log(1111111)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // // 2区域分布
|
|
|
|
+ // var target = {
|
|
|
|
+ // id: idx,
|
|
|
|
+ // attributes: {
|
|
|
|
+ // name: '测试区域分布'
|
|
|
|
+ // },
|
|
|
|
+ // position: item,
|
|
|
|
+ // label: {
|
|
|
|
+ // // text: "测试区域分布",
|
|
|
|
+ // font: "16px Helvetica",
|
|
|
|
+ // color: "rgb(255, 0, 0, .8)",
|
|
|
|
+ // pixelOffset: [0, -50]
|
|
|
|
+ // }
|
|
|
|
+ // };
|
|
|
|
+ // var options = {
|
|
|
|
+ // isZoom: true,
|
|
|
|
+ // click: regionLocateCallBack,
|
|
|
|
+ // style: {
|
|
|
|
+ // color: color[index],
|
|
|
|
+ // transparency: 0.2,
|
|
|
|
+ // outline: true,
|
|
|
|
+ // outlineColor: 'blue',
|
|
|
|
+ // }
|
|
|
|
|
|
- //例:查询图层列表
|
|
|
|
- var JmapQuery = new JMapQuery(window.jMap); // JMap为初始化地图时,实例化的JMap对象
|
|
|
|
|
|
+ // };
|
|
|
|
+ // jMap.Locate.regionLocate(target, options);
|
|
|
|
|
|
- var qp2 = new JMapQueryParam({
|
|
|
|
- queryMapService: "mh_dyn_district",
|
|
|
|
- queryMapLayers: [1],
|
|
|
|
- // queryGeometry: result[0], // 默认进行属性查询,放开该段注释将在选定的几何空间内进行空间查询
|
|
|
|
- // queryWhere: "name like '%莘庄镇%' ", // 可自定义查询条件,也可不传该参数
|
|
|
|
- outFields: ["*"], // 返回字段信息
|
|
|
|
- callBack: testQueryCallBack
|
|
|
|
- });
|
|
|
|
- JmapQuery.execQuery(qp2);
|
|
|
|
|
|
+ // console.log(11111112222222)
|
|
|
|
|
|
|
|
+ // // 分布点点击事件的回调函数
|
|
|
|
+ // function regionLocateCallBack(obj) {
|
|
|
|
+ // console.log(obj); // obj为返回值
|
|
|
|
+ // }
|
|
|
|
|
|
- // 图层查询完毕的回调函数
|
|
|
|
- function testQueryCallBack(obj) {
|
|
|
|
- var bigArr = obj.features;
|
|
|
|
- var bigNewArr = []
|
|
|
|
- bigArr.forEach(function(item, index) {
|
|
|
|
- var aaa = item.geometry.rings[0];
|
|
|
|
- var newArr = aaa.map(function(value, index) {
|
|
|
|
- var obj = {
|
|
|
|
- x: value[0],
|
|
|
|
- y: value[1],
|
|
|
|
- z: 0.1
|
|
|
|
- }
|
|
|
|
- return obj
|
|
|
|
- })
|
|
|
|
- bigNewArr.push(newArr)
|
|
|
|
|
|
+ // }, idx * 1)
|
|
|
|
|
|
- })
|
|
|
|
- let arrayAll = [];
|
|
|
|
- bigNewArr.forEach(function(item, index) {
|
|
|
|
- var idx = index + 1;
|
|
|
|
- console.log(idx)
|
|
|
|
- var color = ["#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", "#009b8a", "#b72727", "#71a382", "#1c6093", "#a4294f", "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", ];
|
|
|
|
|
|
|
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
- console.log(1111111)
|
|
|
|
- //区域分布
|
|
|
|
- var target = {
|
|
|
|
- id: idx,
|
|
|
|
- attributes: {
|
|
|
|
- name: '测试区域分布'
|
|
|
|
- },
|
|
|
|
- position: item,
|
|
|
|
- label: {
|
|
|
|
- // text: "测试区域分布",
|
|
|
|
- font: "16px Helvetica",
|
|
|
|
- color: "rgb(255, 0, 0, .8)",
|
|
|
|
- pixelOffset: [0, -50]
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- var options = {
|
|
|
|
- isZoom: true,
|
|
|
|
- click: regionLocateCallBack,
|
|
|
|
- style: {
|
|
|
|
- color: color[index],
|
|
|
|
- transparency: 0.2,
|
|
|
|
- outline: true,
|
|
|
|
- outlineColor: 'blue',
|
|
|
|
- }
|
|
|
|
|
|
+ // item.forEach(function(i) {
|
|
|
|
+ // arrayAll.push(i)
|
|
|
|
+ // })
|
|
|
|
+ // })
|
|
|
|
+ // console.log(222)
|
|
|
|
+ // console.log(arrayAll)
|
|
|
|
+ // }
|
|
|
|
|
|
- };
|
|
|
|
- jMap.Locate.regionLocate(target, options);
|
|
|
|
|
|
|
|
- console.log(11111112222222)
|
|
|
|
|
|
|
|
- // 分布点点击事件的回调函数
|
|
|
|
- function regionLocateCallBack(obj) {
|
|
|
|
- console.log(obj); // obj为返回值
|
|
|
|
- }
|
|
|
|
|
|
|
|
- }, idx * 1)
|
|
|
|
|
|
+ var JmapQuery = new JMapQuery(window.jMap); // JMap为初始化地图时,实例化的JMap对象
|
|
|
|
|
|
|
|
+ //例:8.1 1:查询图层记录总量
|
|
|
|
+
|
|
|
|
+ // var qp = new JMapQueryParam({
|
|
|
|
+ // queryMapService: "mh_dyn_cywg",
|
|
|
|
+ // queryMapLayers: [1],
|
|
|
|
+ // returnCountOnly: true,
|
|
|
|
+ // callBack: testQueryCallBack
|
|
|
|
+ // });
|
|
|
|
+ // JmapQuery.execQuery(qp);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 例: 8.1 2 查询图层列表
|
|
|
|
+ // var qp2 = new JMapQueryParam({
|
|
|
|
+ // queryMapService: "mh_dyn_cywg",
|
|
|
|
+ // queryMapLayers: [0],
|
|
|
|
+ // // queryGeometry: result[0], // 默认进行属性查询,放开该段注释将在选定的几何空间内进行空间查询
|
|
|
|
+ // // queryWhere: "name like '%莘庄镇%' ", // 可自定义查询条件,也可不传该参数
|
|
|
|
+ // outFields: ["*"], // 返回字段信息
|
|
|
|
+ // callBack: testQueryCallBack
|
|
|
|
+ // });
|
|
|
|
+ // JmapQuery.execQuery(qp2);
|
|
|
|
+ // // 图层查询完毕的回调函数
|
|
|
|
+ // function testQueryCallBack(obj) {
|
|
|
|
+ // var bigNewArr = [];
|
|
|
|
+ // var name = [];
|
|
|
|
+ // var bigArr = obj.features.filter(function(el) {
|
|
|
|
+ // return el.attributes.name.indexOf('华漕') > -1
|
|
|
|
+ // })
|
|
|
|
+ // console.log(bigArr)
|
|
|
|
+ // bigArr.forEach(function(item, index) {
|
|
|
|
+ // var aaa = item.geometry.rings[0];
|
|
|
|
+ // var newArr = aaa.map(function(value, index) {
|
|
|
|
+ // var obj = {
|
|
|
|
+ // x: value[0],
|
|
|
|
+ // y: value[1],
|
|
|
|
+ // z: 0.1
|
|
|
|
+ // }
|
|
|
|
+ // return obj
|
|
|
|
+ // })
|
|
|
|
+ // bigNewArr.push(newArr);
|
|
|
|
+ // name.push(item.attributes.name)
|
|
|
|
+
|
|
|
|
+ // })
|
|
|
|
+ // let arrayAll = [];
|
|
|
|
+ // console.log(bigNewArr)
|
|
|
|
+ // console.log(name)
|
|
|
|
+ // bigNewArr.forEach(function(item, index) {
|
|
|
|
+ // var idx = index + 1;
|
|
|
|
+ // var color = ["#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", "#009b8a", "#b72727", "#71a382", "#1c6093", "#a4294f", "#3f8a3f", "#68afc1", "#5081c5", "#c3a102", "#d17100", ];
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
+
|
|
|
|
+ // // 2区域分布
|
|
|
|
+ // var target = {
|
|
|
|
+ // id: idx,
|
|
|
|
+ // attributes: {
|
|
|
|
+ // name: name[index]
|
|
|
|
+ // },
|
|
|
|
+ // position: item,
|
|
|
|
+ // label: {
|
|
|
|
+ // text: name[index],
|
|
|
|
+ // font: "16px Helvetica",
|
|
|
|
+ // color: "rgb(255, 0, 0, .8)",
|
|
|
|
+ // pixelOffset: [0, -40]
|
|
|
|
+ // }
|
|
|
|
+ // };
|
|
|
|
+ // var options = {
|
|
|
|
+ // isZoom: true,
|
|
|
|
+ // click: regionLocateCallBack,
|
|
|
|
+ // style: {
|
|
|
|
+ // color: color[index],
|
|
|
|
+ // transparency: 0.6,
|
|
|
|
+ // outline: true,
|
|
|
|
+ // outlineColor: 'blue',
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
+ // };
|
|
|
|
+ // jMap.Locate.regionLocate(target, options);
|
|
|
|
|
|
- item.forEach(function(i) {
|
|
|
|
- arrayAll.push(i)
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
- console.log(222)
|
|
|
|
- console.log(arrayAll)
|
|
|
|
|
|
+ // // 分布点点击事件的回调函数
|
|
|
|
+ // function regionLocateCallBack(obj) {
|
|
|
|
+ // console.log(obj); // obj为返回值
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
+ // }, idx * 1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ // item.forEach(function(i) {
|
|
|
|
+ // arrayAll.push(i)
|
|
|
|
+ // })
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -198,12 +296,70 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ //8.2
|
|
|
|
+ // var options = {
|
|
|
|
+ // click: addLayerCallBack,
|
|
|
|
+ // isZoom: false,
|
|
|
|
+ // style: {
|
|
|
|
+ // outline: true,
|
|
|
|
+ // outlineColor: "rgb(255,0,0,0.8)",
|
|
|
|
+ // material: "rgb(154,255,154,0)",
|
|
|
|
+ // perPositionHeight: false,
|
|
|
|
+ // height: 5,
|
|
|
|
+ // width: 5,
|
|
|
|
+ // label: {
|
|
|
|
+ // show: true,
|
|
|
|
+ // text: 'name',
|
|
|
|
+ // font: "12px Helvetica",
|
|
|
|
+ // fillColor: 'rgb(0,255,0,0.9)',
|
|
|
|
+ // pixelOffset: [0, -40],
|
|
|
|
+ // backgroundColor: 'rgb(0,0,0,0)',
|
|
|
|
+ // showBackground: false
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
|
|
+ // // where: "name = '莘庄镇'"
|
|
|
|
|
|
|
|
+ // };
|
|
|
|
+ // jMap.addLayer('mh_dyn_cywg', [0], options);
|
|
|
|
+ // // 点击事件回调函数
|
|
|
|
+ // function addLayerCallBack(obj) {
|
|
|
|
+ // console.log(obj);
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
|
|
|
+ //例 8.1 4:图层分组统计,这里查询居委图层,按所属街镇字段进行分组统计,统计各街镇下居委数量
|
|
|
|
+ // console.log(111111111)
|
|
|
|
+ // var qp4 = new JMapQueryParam({
|
|
|
|
+ // queryMapService: "mh_dyn_district",
|
|
|
|
+ // queryMapLayers: [2],
|
|
|
|
+ // groupByFieldsForStatistics: ['subdistrict'], // 所需进行分组查询字段
|
|
|
|
+ // onStatisticField: 'subdistrict', // 将在其上计算统计信息的字段名称
|
|
|
|
+ // statisticType: 'count', // 统计信息的类型
|
|
|
|
+ // outStatisticFieldName: 'num', // 指定输出字段名称(别名)
|
|
|
|
+ // callBack: testQueryCallBack
|
|
|
|
+ // });
|
|
|
|
+ // JmapQuery.execQuery(qp4);
|
|
|
|
+ // // 图层查询完毕的回调函数
|
|
|
|
+ // function testQueryCallBack(obj) {
|
|
|
|
+ // console.log(obj); // obj为返回值
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ // //例8.1 2:查询图层列表
|
|
|
|
+ var qp2 = new JMapQueryParam({
|
|
|
|
+ queryMapService: "mh_dyn_district",
|
|
|
|
+ queryMapLayers: [2],
|
|
|
|
+ // queryGeometry: result[0], // 默认进行属性查询,放开该段注释将在选定的几何空间内进行空间查询
|
|
|
|
+ queryWhere: "莘庄镇", // 可自定义查询条件,也可不传该参数
|
|
|
|
+ outFields: ["*"], // 返回字段信息
|
|
|
|
+ callBack: testQueryCallBack
|
|
|
|
+ });
|
|
|
|
+ console.log(2222222222222)
|
|
|
|
+ JmapQuery.execQuery(qp2);
|
|
|
|
+ // 图层查询完毕的回调函数
|
|
|
|
+ function testQueryCallBack(obj) {
|
|
|
|
+ console.log(obj); // obj为返回值
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -215,28 +371,25 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
// 街镇标题
|
|
// 街镇标题
|
|
- var qp = new JMapQueryParam({
|
|
|
|
- queryMapService: "mh_dyn_district",
|
|
|
|
- queryMapLayers: [1],
|
|
|
|
- outFields: ["code", "name", "center_x", "center_y"],
|
|
|
|
- queryWhere: "name like '%莘庄镇%' ",
|
|
|
|
- callBack: (res) => {
|
|
|
|
-
|
|
|
|
- res.features.forEach(async(val) => {
|
|
|
|
- await window.jMap.FlagInfo.show({
|
|
|
|
- id: val.attributes.code,
|
|
|
|
- position: { x: Number(val.attributes.center_x), y: Number(val.attributes.center_y), z: 0 },
|
|
|
|
- element: `<div class='ysc-dynamic-layer ys-css3-box' onclick="vue.clickFlag(${val.attributes.code})">
|
|
|
|
- <div class='biaozhu' style="font-size:18px !important">${val.attributes.name} ${val.attributes.code}</div>
|
|
|
|
- </div>`,
|
|
|
|
- }, { isZoom: false });
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
|
|
+ // var qp = new JMapQueryParam({
|
|
|
|
+ // queryMapService: "mh_dyn_district",
|
|
|
|
+ // queryMapLayers: [1],
|
|
|
|
+ // outFields: ["code", "name", "center_x", "center_y"],
|
|
|
|
+ // queryWhere: "name like '%莘庄镇%' ",
|
|
|
|
+ // callBack: (res) => {
|
|
|
|
+
|
|
|
|
+ // res.features.forEach(async(val) => {
|
|
|
|
+ // await window.jMap.FlagInfo.show({
|
|
|
|
+ // id: val.attributes.code,
|
|
|
|
+ // position: { x: Number(val.attributes.center_x), y: Number(val.attributes.center_y), z: 0 },
|
|
|
|
+ // element: `<div class='ysc-dynamic-layer ys-css3-box' onclick="vue.clickFlag(${val.attributes.code})">
|
|
|
|
+ // <div class='biaozhu' style="font-size:18px !important">${val.attributes.name} ${val.attributes.code}</div>
|
|
|
|
+ // </div>`,
|
|
|
|
+ // }, { isZoom: false });
|
|
|
|
+ // });
|
|
|
|
+ // },
|
|
|
|
+ // });
|
|
|
|
|
|
// new JMapQuery(window.jMap).execQuery(qp)
|
|
// new JMapQuery(window.jMap).execQuery(qp)
|
|
|
|
|