diff --git a/src/components/Map/ArcGISConfig.js b/src/components/Map/ArcGISConfig.js index a1f843f..11fdcf7 100644 --- a/src/components/Map/ArcGISConfig.js +++ b/src/components/Map/ArcGISConfig.js @@ -4,13 +4,13 @@ mapIp: '223.84.218.107', // 服务ip mapPort: '6080', // 服务端口 // serverBase: 'http://192.168.8.205:6080/arcgis/rest/services/', // 服务地址前缀 - serverBase: 'http://223.84.218.107:6080/arcgis/rest/services/dx/', + serverBase: 'http://111.198.10.15:13002/arcgis/rest/services/', mapCenter: '[116.597,28.24]' // 地图中心点 } export const serverConfig = { - mapUrlBase: mapConfig.serverBase + '2w/MapServer', // 底图服务地址 - mapUrlBj: mapConfig.serverBase + 'dxbj/MapServer', // 部件服务地址 - mapUrlBjfc: mapConfig.serverBase + 'bjfc/MapServer', // 部件分层服务地址 - mapUrlBjEdit: mapConfig.serverBase + 'dxbj/FeatureServer' // 可编辑的部件图层 + mapUrlBase: mapConfig.serverBase + 'cr_dt/MapServer', // 底图服务地址 + mapUrlBj: mapConfig.serverBase + 'cr_bj/FeatureServer', // 部件服务地址 + mapUrlBjfc: mapConfig.serverBase + 'cr_bjfc/MapServer', // 部件分层服务地址 + mapUrlBjEdit: mapConfig.serverBase + 'cr_bj/FeatureServer' // 可编辑的部件图层 } diff --git a/src/components/Map/ArcGISConfig.js b/src/components/Map/ArcGISConfig.js index a1f843f..11fdcf7 100644 --- a/src/components/Map/ArcGISConfig.js +++ b/src/components/Map/ArcGISConfig.js @@ -4,13 +4,13 @@ mapIp: '223.84.218.107', // 服务ip mapPort: '6080', // 服务端口 // serverBase: 'http://192.168.8.205:6080/arcgis/rest/services/', // 服务地址前缀 - serverBase: 'http://223.84.218.107:6080/arcgis/rest/services/dx/', + serverBase: 'http://111.198.10.15:13002/arcgis/rest/services/', mapCenter: '[116.597,28.24]' // 地图中心点 } export const serverConfig = { - mapUrlBase: mapConfig.serverBase + '2w/MapServer', // 底图服务地址 - mapUrlBj: mapConfig.serverBase + 'dxbj/MapServer', // 部件服务地址 - mapUrlBjfc: mapConfig.serverBase + 'bjfc/MapServer', // 部件分层服务地址 - mapUrlBjEdit: mapConfig.serverBase + 'dxbj/FeatureServer' // 可编辑的部件图层 + mapUrlBase: mapConfig.serverBase + 'cr_dt/MapServer', // 底图服务地址 + mapUrlBj: mapConfig.serverBase + 'cr_bj/FeatureServer', // 部件服务地址 + mapUrlBjfc: mapConfig.serverBase + 'cr_bjfc/MapServer', // 部件分层服务地址 + mapUrlBjEdit: mapConfig.serverBase + 'cr_bj/FeatureServer' // 可编辑的部件图层 } diff --git a/src/components/Map/arcgisMap.vue b/src/components/Map/arcgisMap.vue index ba8aeb4..0d98798 100644 --- a/src/components/Map/arcgisMap.vue +++ b/src/components/Map/arcgisMap.vue @@ -60,7 +60,10 @@ dxbjLine: '', // 部件线图层 dxbjXqd: '', // 兴趣点图层 dxbjMph: '', // 门牌好图层 - dx2wGrid: '' // 单元网格图层 + dx2wGrid: '', // 单元网格图层 + trafficLine: '', // 交通线 + vegPlane: '' // 植被面 + }, esriObj: { Map: '', @@ -176,7 +179,7 @@ this.view = new this.esriObj.MapView({ container: this.$refs.mapDiv, // 视图的容器 map: this.map, // Map的实例放入视图中 - center: [116.597, 28.24], // 初始显示的地图中心点,经纬度 + center: [116.06021, 27.75962], // 初始显示的地图中心点,经纬度 zoom: 3 // 当前地图缩放等级 }) this.view.ui._removeComponents(['zoom']) @@ -185,10 +188,11 @@ this.view.on('click', function(event) { // 清除地图上已有的事件/部件查询点 that.clearEOrCPoint() + console.log('event.mapPoint', event.mapPoint) const lon = event.mapPoint.longitude const lat = event.mapPoint.latitude - + // debugger if (that.showEventPointPopup) { // 添加点 const gLayer = new that.esriObj.GraphicsLayer() @@ -217,24 +221,25 @@ query.distance = 10 query.units = 'meters' query.returnGeometry = true - query.outFields = ['BGID', 'COMMUID', 'COMMUNAME'] + query.outFields = ['CommuName ', 'CommuId ', 'Commuarea ', 'StreetId ', 'StreetName '] console.log(that.layers.dx2wGrid) that.layers.dx2wGrid.queryFeatures(query) .then(function(response) { - console.log(response) + console.log('response', response) const result = response.features[0].attributes // 赋值 that.longitude = lon that.latitude = lat - that.gridId = result.BGID - that.communityId = result.COMMUID - that.communityName = result.COMMUNAME + that.gridId = result.CommuId + that.communityId = result.CommuId + that.communityName = result.CommuName // 2弹出气泡 that.view.popup.open({ title: '事件定位', - content: '坐标:[' + lon.toFixed(4) + ', ' + lat.toFixed(4) + ']' + '
' + '所在社区:' + result.COMMUNAME, + content: '坐标:[' + lon.toFixed(4) + ', ' + lat.toFixed(4) + ']' + '
' + '所在社区:' + result.CommuName, + // content: '坐标:[' + event.mapPoint.x.toFixed(4) + ', ' + event.mapPoint.y.toFixed(4) + ']' + '
' + '所在社区:' + result.CommuName, location: event.mapPoint }) }) @@ -249,20 +254,21 @@ }) queryDev.geometry = circle queryDev.returnGeometry = true - queryDev.outFields = ['BGID', 'OBJID', 'OBJNAME', 'OBJPOS'] + queryDev.outFields = ['objectid ', '大类代码 ', '大类名称', '小类代码', '小类名称', '编码'] that.layers.dxbjPoint.queryFeatures(queryDev) .then(function(response) { if (response.features.length > 0) { const results = response.features - + console.log('results',results) that.compListOpts = [] + // todo 部件名称、部件编码 let content = '' results.forEach((item, index) => { - content += '
部件' + (index + 1) + ':' + item.attributes.OBJNAME + ',' + item.attributes.OBJPOS + content += '
部件' + (index + 1) + ':' + item.attributes.大类名称 + '-' + item.attributes.小类名称 + '-' + item.attributes.编码 const comp = {} - comp.name = '部件' + (index + 1) + ':' + item.attributes.OBJNAME - comp.value = item.attributes.OBJID + comp.name = '部件' + (index + 1) + ':' + item.attributes.大类名称 + '-' + item.attributes.小类名称 + '-' + item.attributes.编码 + comp.value = item.attributes.编码 that.compListOpts.push(comp) }) @@ -321,7 +327,7 @@ addBjLayers: function() { // 此处可以优化 this.layers.dxbjPoint = new this.esriObj.FeatureLayer({ // 可配置属性,见TileLayer类 - url: serverConfig.mapUrlBj + '/0', + url: serverConfig.mapUrlBj + '/2', id: 'dxbjPoint' }) this.layers.dxbjLine = new this.esriObj.FeatureLayer({ // 可配置属性,见TileLayer类 @@ -337,7 +343,7 @@ id: 'dxbjMph' }) this.layers.dx2wGrid = new this.esriObj.FeatureLayer({ - url: serverConfig.mapUrlBase + '/6', + url: serverConfig.mapUrlBase + '/16', id: 'gridLayer' }) diff --git a/src/components/Map/ArcGISConfig.js b/src/components/Map/ArcGISConfig.js index a1f843f..11fdcf7 100644 --- a/src/components/Map/ArcGISConfig.js +++ b/src/components/Map/ArcGISConfig.js @@ -4,13 +4,13 @@ mapIp: '223.84.218.107', // 服务ip mapPort: '6080', // 服务端口 // serverBase: 'http://192.168.8.205:6080/arcgis/rest/services/', // 服务地址前缀 - serverBase: 'http://223.84.218.107:6080/arcgis/rest/services/dx/', + serverBase: 'http://111.198.10.15:13002/arcgis/rest/services/', mapCenter: '[116.597,28.24]' // 地图中心点 } export const serverConfig = { - mapUrlBase: mapConfig.serverBase + '2w/MapServer', // 底图服务地址 - mapUrlBj: mapConfig.serverBase + 'dxbj/MapServer', // 部件服务地址 - mapUrlBjfc: mapConfig.serverBase + 'bjfc/MapServer', // 部件分层服务地址 - mapUrlBjEdit: mapConfig.serverBase + 'dxbj/FeatureServer' // 可编辑的部件图层 + mapUrlBase: mapConfig.serverBase + 'cr_dt/MapServer', // 底图服务地址 + mapUrlBj: mapConfig.serverBase + 'cr_bj/FeatureServer', // 部件服务地址 + mapUrlBjfc: mapConfig.serverBase + 'cr_bjfc/MapServer', // 部件分层服务地址 + mapUrlBjEdit: mapConfig.serverBase + 'cr_bj/FeatureServer' // 可编辑的部件图层 } diff --git a/src/components/Map/arcgisMap.vue b/src/components/Map/arcgisMap.vue index ba8aeb4..0d98798 100644 --- a/src/components/Map/arcgisMap.vue +++ b/src/components/Map/arcgisMap.vue @@ -60,7 +60,10 @@ dxbjLine: '', // 部件线图层 dxbjXqd: '', // 兴趣点图层 dxbjMph: '', // 门牌好图层 - dx2wGrid: '' // 单元网格图层 + dx2wGrid: '', // 单元网格图层 + trafficLine: '', // 交通线 + vegPlane: '' // 植被面 + }, esriObj: { Map: '', @@ -176,7 +179,7 @@ this.view = new this.esriObj.MapView({ container: this.$refs.mapDiv, // 视图的容器 map: this.map, // Map的实例放入视图中 - center: [116.597, 28.24], // 初始显示的地图中心点,经纬度 + center: [116.06021, 27.75962], // 初始显示的地图中心点,经纬度 zoom: 3 // 当前地图缩放等级 }) this.view.ui._removeComponents(['zoom']) @@ -185,10 +188,11 @@ this.view.on('click', function(event) { // 清除地图上已有的事件/部件查询点 that.clearEOrCPoint() + console.log('event.mapPoint', event.mapPoint) const lon = event.mapPoint.longitude const lat = event.mapPoint.latitude - + // debugger if (that.showEventPointPopup) { // 添加点 const gLayer = new that.esriObj.GraphicsLayer() @@ -217,24 +221,25 @@ query.distance = 10 query.units = 'meters' query.returnGeometry = true - query.outFields = ['BGID', 'COMMUID', 'COMMUNAME'] + query.outFields = ['CommuName ', 'CommuId ', 'Commuarea ', 'StreetId ', 'StreetName '] console.log(that.layers.dx2wGrid) that.layers.dx2wGrid.queryFeatures(query) .then(function(response) { - console.log(response) + console.log('response', response) const result = response.features[0].attributes // 赋值 that.longitude = lon that.latitude = lat - that.gridId = result.BGID - that.communityId = result.COMMUID - that.communityName = result.COMMUNAME + that.gridId = result.CommuId + that.communityId = result.CommuId + that.communityName = result.CommuName // 2弹出气泡 that.view.popup.open({ title: '事件定位', - content: '坐标:[' + lon.toFixed(4) + ', ' + lat.toFixed(4) + ']' + '
' + '所在社区:' + result.COMMUNAME, + content: '坐标:[' + lon.toFixed(4) + ', ' + lat.toFixed(4) + ']' + '
' + '所在社区:' + result.CommuName, + // content: '坐标:[' + event.mapPoint.x.toFixed(4) + ', ' + event.mapPoint.y.toFixed(4) + ']' + '
' + '所在社区:' + result.CommuName, location: event.mapPoint }) }) @@ -249,20 +254,21 @@ }) queryDev.geometry = circle queryDev.returnGeometry = true - queryDev.outFields = ['BGID', 'OBJID', 'OBJNAME', 'OBJPOS'] + queryDev.outFields = ['objectid ', '大类代码 ', '大类名称', '小类代码', '小类名称', '编码'] that.layers.dxbjPoint.queryFeatures(queryDev) .then(function(response) { if (response.features.length > 0) { const results = response.features - + console.log('results',results) that.compListOpts = [] + // todo 部件名称、部件编码 let content = '' results.forEach((item, index) => { - content += '
部件' + (index + 1) + ':' + item.attributes.OBJNAME + ',' + item.attributes.OBJPOS + content += '
部件' + (index + 1) + ':' + item.attributes.大类名称 + '-' + item.attributes.小类名称 + '-' + item.attributes.编码 const comp = {} - comp.name = '部件' + (index + 1) + ':' + item.attributes.OBJNAME - comp.value = item.attributes.OBJID + comp.name = '部件' + (index + 1) + ':' + item.attributes.大类名称 + '-' + item.attributes.小类名称 + '-' + item.attributes.编码 + comp.value = item.attributes.编码 that.compListOpts.push(comp) }) @@ -321,7 +327,7 @@ addBjLayers: function() { // 此处可以优化 this.layers.dxbjPoint = new this.esriObj.FeatureLayer({ // 可配置属性,见TileLayer类 - url: serverConfig.mapUrlBj + '/0', + url: serverConfig.mapUrlBj + '/2', id: 'dxbjPoint' }) this.layers.dxbjLine = new this.esriObj.FeatureLayer({ // 可配置属性,见TileLayer类 @@ -337,7 +343,7 @@ id: 'dxbjMph' }) this.layers.dx2wGrid = new this.esriObj.FeatureLayer({ - url: serverConfig.mapUrlBase + '/6', + url: serverConfig.mapUrlBase + '/16', id: 'gridLayer' }) diff --git a/src/components/Map/arcgisMapRead.vue b/src/components/Map/arcgisMapRead.vue index 7855259..959568a 100644 --- a/src/components/Map/arcgisMapRead.vue +++ b/src/components/Map/arcgisMapRead.vue @@ -87,26 +87,18 @@ QueryTask: '', IdentifyTask: '', IdentifyParameters: '', - MapView: '' + MapView: '', + SpatialReference: '' }, mapLoading: false - // keywords: '', // 查询关键字 - // showEventPointPopup: true, // 是否显示事部件的popup - // queryEventSwitch: '1', // 1==查询事件;0==查询部件 - // compListOpts: [], // 部件选择下拉框option - // 主页面返回值 - // longitude: '', // 定位点经度 - // latitude: '' // 定位点纬度 - // communityId: '', // 社区ID - // communityName: '', // 社区名称 - // gridId: '', // 单元网格ID - // componentId: '', // 部件ID - // componentName: '' // 部件名称/= } }, mounted() { this.importEsri() }, + activated() { + this.importEsri() + }, methods: { // 初始化ArcGIS API对象 importEsri: function() { @@ -118,6 +110,7 @@ 'esri/PopupTemplate', 'esri/geometry/Circle', 'esri/geometry/Point', + 'esri/geometry/SpatialReference', 'esri/layers/FeatureLayer', 'esri/layers/GraphicsLayer', 'esri/layers/TileLayer', @@ -127,6 +120,7 @@ 'esri/tasks/IdentifyTask', 'esri/tasks/support/IdentifyParameters', 'esri/views/MapView', + 'dojo/domReady!' ], option) .then(([ @@ -136,6 +130,7 @@ PopupTemplate, Circle, Point, + SpatialReference, FeatureLayer, GraphicsLayer, TileLayer, @@ -145,6 +140,7 @@ IdentifyTask, IdentifyParameters, MapView + ]) => { this.esriObj.Map = Map this.esriObj.BaseMap = BaseMap @@ -161,6 +157,7 @@ this.esriObj.IdentifyTask = IdentifyTask this.esriObj.IdentifyParameters = IdentifyParameters this.esriObj.MapView = MapView + this.esriObj.SpatialReference = SpatialReference // 初始化地图 this.initMap() @@ -175,12 +172,12 @@ const base = new this.esriObj.BaseMap({ baseLayers: [ new this.esriObj.TileLayer({ // 可配置属性,见TileLayer类 - id: '2w', + id: 'cr_dt', url: serverConfig.mapUrlBase }) ], - title: 'dx2w', - id: 'dx2w' + title: 'cr_dt', + id: 'cr_dt' }) this.map = new this.esriObj.Map({ @@ -194,137 +191,6 @@ zoom: 3 // 当前地图缩放等级 }) - // const that = this - // this.view.on('click', function(event) { - // // 清除地图上已有的事件/部件查询点 - // that.clearEOrCPoint() - - // const lon = event.mapPoint.longitude - // const lat = event.mapPoint.latitude - - // if (that.showEventPointPopup) { - // // 添加点 - // const gLayer = new that.esriObj.GraphicsLayer() - // const marker = new that.esriObj.SimpleMarkerSymbol() - // marker.color = '#35A0E7' - // marker.style = 'square' - // marker.outline = { - // color: [128, 128, 128, 0.5], - // width: '2px' - // } - // const graphic = new that.esriObj.Graphic({ - // geometry: event.mapPoint, - // symbol: marker - // }) - - // gLayer.id = eventPointLayerId - // gLayer.add(graphic) - // that.map.add(gLayer) - - // // 查询事件或者部件 - // if (that.queryEventSwitch === '1') { - // // 事件定位 - // // 1查询底图得到所在网格与所在社区 - // const query = that.layers.dx2wGrid.createQuery() - // query.geometry = that.view.toMap(event) - // query.distance = 10 - // query.units = 'meters' - // query.returnGeometry = true - // query.outFields = ['BGID', 'COMMUID', 'COMMUNAME'] - // that.layers.dx2wGrid.queryFeatures(query) - // .then(function(response) { - // const result = response.features[0].attributes - - // // 赋值 - // that.longitude = lon - // that.latitude = lat - // that.gridId = result.BGID - // that.communityId = result.COMMUID - // that.communityName = result.COMMUNAME - - // // 2弹出气泡 - // that.view.popup.open({ - // title: '事件定位', - // content: '坐标:[' + lon.toFixed(4) + ', ' + lat.toFixed(4) + ']' + '
' + '所在社区:' + result.COMMUNAME, - // location: event.mapPoint - // }) - // }) - // } else if (that.queryEventSwitch === '0') { - // // 部件定位 - // const queryDev = that.layers.dxbjPoint.createQuery() - // // 定义查询的圆形范围,半径5米 - // const circle = new that.esriObj.Circle({ - // center: event.mapPoint, - // radius: 5, - // radiusUnit: 'meters' - // }) - // queryDev.geometry = circle - // queryDev.returnGeometry = true - // queryDev.outFields = ['BGID', 'OBJID', 'OBJNAME', 'OBJPOS'] - // that.layers.dxbjPoint.queryFeatures(queryDev) - // .then(function(response) { - // if (response.features.length > 0) { - // const results = response.features - - // that.compListOpts = [] - - // let content = '' - // results.forEach((item, index) => { - // content += '
部件' + (index + 1) + ':' + item.attributes.OBJNAME + ',' + item.attributes.OBJPOS - // const comp = {} - // comp.name = '部件' + (index + 1) + ':' + item.attributes.OBJNAME - // comp.value = item.attributes.OBJID - // that.compListOpts.push(comp) - // }) - - // // 2弹出气泡 - // that.view.popup.open({ - // title: '部件定位', - // content: '坐标:[' + lon.toFixed(4) + ', ' + lat.toFixed(4) + '],附近5米的部件有:' + content, - // location: event.mapPoint - // }) - - // // 查询所在社区和单元网格 - // const queryPos = that.layers.dx2wGrid.createQuery() - // queryPos.geometry = that.view.toMap(event) - // queryPos.returnGeometry = true - // queryPos.outFields = ['BGID', 'COMMUID', 'COMMUNAME'] - // that.layers.dx2wGrid.queryFeatures(queryPos) - // .then(function(response) { - // const result = response.features[0].attributes - - // // 赋值 - // that.longitude = lon - // that.latitude = lat - // that.gridId = result.BGID - // that.communityId = result.COMMUID - // that.communityName = result.COMMUNAME - // }) - // } else { - // that.$message({ - // message: '没有查询到部件,请重新定位', - // type: 'warning' - // }) - // } - // }) - // } - // } else { - // that.view.hitTest(event).then(function(response) { - // if (response.results.length) { - // const graphic = response.results[0].graphic - // const name = graphic.attributes.KEYWORD - // const address = graphic.attributes.OBJPOS - - // that.view.popup.open({ - // title: name, - // content: address, - // location: event.mapPoint - // }) - // } - // }) - // } - // }) - this.addBjLayers() this.addCasePointOnMap(this.longitude, this.latitude) }, @@ -332,180 +198,41 @@ addBjLayers: function() { // 此处可以优化 this.layers.dxbjPoint = new this.esriObj.FeatureLayer({ // 可配置属性,见TileLayer类 - url: serverConfig.mapUrlBj + '/0', + url: serverConfig.mapUrlBj + '/2', id: 'dxbjPoint' }) this.layers.dxbjLine = new this.esriObj.FeatureLayer({ // 可配置属性,见TileLayer类 url: serverConfig.mapUrlBj + '/1', id: 'dxbjLine' }) - this.layers.dxbjXqd = new this.esriObj.FeatureLayer({ // 可配置属性,见TileLayer类 - url: serverConfig.mapUrlBj + '/2', - id: 'dxbjXqd' - }) - this.layers.dxbjMph = new this.esriObj.FeatureLayer({ // 可配置属性,见TileLayer类 - url: serverConfig.mapUrlBj + '/3', - id: 'dxbjMph' - }) + // this.layers.dxbjXqd = new this.esriObj.FeatureLayer({ // 可配置属性,见TileLayer类 + // url: serverConfig.mapUrlBj + '/2', + // id: 'dxbjXqd' + // }) + // this.layers.dxbjMph = new this.esriObj.FeatureLayer({ // 可配置属性,见TileLayer类 + // url: serverConfig.mapUrlBj + '/3', + // id: 'dxbjMph' + // }) this.layers.dx2wGrid = new this.esriObj.FeatureLayer({ - url: serverConfig.mapUrlBase + '/1', + url: serverConfig.mapUrlBase + '/16', id: 'gridLayer' }) // 加载各图层 this.map.add(this.layers.dxbjPoint) this.map.add(this.layers.dxbjLine) - this.map.add(this.layers.dxbjXqd) - this.map.add(this.layers.dxbjMph) + // this.map.add(this.layers.dxbjXqd) + // this.map.add(this.layers.dxbjMph) this.map.add(this.layers.dx2wGrid) }, - // 在兴趣点图层查询关键字 - // queryOnMap: function() { - // const points = [] // 查询结果点集 - - // this.clearQueryResults() - // this.clearEOrCPoint() - // this.showEventPointPopup = false - // this.queryEventSwitch = '2' - - // // 查询条件 - // const query = new this.esriObj.Query() - // query.returnGeometry = true - // query.outFields = ['*'] - // query.where = 'NAME like ' + "'%" + this.keywords + "%'" - // const that = this - - // this.layers.dxbjXqd.queryFeatures(query).then(function(results) { - // results.features.forEach(item => { - // const point = {} - // point.x = item.geometry.longitude - // point.y = item.geometry.latitude - // point.attr = item.attributes - // points.push(point) - // }) - - // // 提示查询结果 - // if (points.length > 0) { - // that.$message({ - // message: '成功查询到' + points.length + '条记录', - // type: 'success' - // }) - - // // 绘制点 - // that.addSimpleMarkerOnMap(points) - // } else { - // that.$message({ - // message: '没有查询到结果,请重新输入关键字', - // type: 'warning' - // }) - // } - // }) - // }, - // 清除图层上的查询结果 - // clearQueryResults: function() { - // this.map.layers.forEach(layer => { - // if (layer.type === 'graphics' && layer.id === queryResultLayerId) { - // layer.graphics.removeAll() - // return false - // } - // }) - // }, - // // 清除图层上的查询结果 - // clearMap: function() { - // // 清除地图上绘制的graphic图层 - // this.map.layers.forEach(layer => { - // if (layer.type === 'graphics') { - // layer.graphics.removeAll() - // return false - // } - // }) - - // // 清除弹出框 - // this.view.popup.close() - - // // 清除data属性值 - // this.keywords = '' - // this.showEventPointPopup = true // 是否显示事部件的popup - // this.queryEventSwitch = '1' // 1==查询事件;0==查询部件 - // this.compListOpts = [] // 部件选择下拉框option - // this.longitude = '' // 定位点经度 - // this.latitude = '' // 定位点纬度 - // this.communityId = '' // 社区ID - // this.communityName = '' // 社区名称 - // this.gridId = '' // 单元网格ID - // this.componentId = '' // 部件ID - // this.componentName = '' // 部件名称 - // }, - // 清除图层上的事件定位点 - // clearEOrCPoint: function() { - // this.map.layers.forEach(layer => { - // if (layer.type === 'graphics' && layer.id === eventPointLayerId) { - // layer.graphics.removeAll() - // return false - // } - // }) - // // 清除弹出框 - // this.view.popup.close() - // }, - // 切换 - // switchEventOrComponent: function() { - // // 如果选中的是事件定位(1)或部件定位(0),点击地图时弹出事件或者部件的popup;否则(2以上)显示兴趣点结果的属性popup - // this.showEventPointPopup = this.queryEventSwitch < 2 - // }, - // 将查询结果点集合绘制在地图上 - // addSimpleMarkerOnMap: function(points) { - // const gLayer = new this.esriObj.GraphicsLayer() - // points.forEach(item => { - // const point = new this.esriObj.Point(item.x, item.y, item.attr) - // const marker = new this.esriObj.SimpleMarkerSymbol() - // marker.color = '#F9690E' - // marker.outline = { - // color: [128, 128, 128, 0.5], - // width: '2px' - // } - // const graphic = new this.esriObj.Graphic({ - // geometry: point, - // symbol: marker, - // attributes: item.attr - // }) - // gLayer.id = queryResultLayerId - // gLayer.add(graphic) - // }) - // this.map.add(gLayer) - // }, - // 返回事件定位的结果 - // checkEventPoint: function() { - // this.$emit( - // 'closeMapQueryDialogByEvent', - // this.longitude, - // this.latitude, - // this.communityId, - // this.communityName, - // this.gridId) - - // this.clearMap() - // }, - // // 返回部件定位的结果 - // checkComponentPoint: function() { - // this.$emit( - // 'closeMapQueryDialogByComp', - // this.longitude, - // this.latitude, - // this.communityId, - // this.communityName, - // this.gridId, - // this.componentId) - - // this.clearMap() - // }, // 在地图上添加指定坐标的点 addCasePointOnMap: function(lng, lat) { console.log('addCasePointOnMap', lng, lat) const gLayer = new this.esriObj.GraphicsLayer() // 添加自定义绘制点的图层 - const point = new this.esriObj.Point(lng, lat) // 创建geometry对象 + const point = new this.esriObj.Point(lng, lat, new this.esriObj.SpatialReference(4490)) // 创建geometry对象 const marker = new this.esriObj.SimpleMarkerSymbol() // 创建marker标识 // marker属性 - marker.color = '#F9690E' + marker.color = 'red' // #F9690E marker.outline = { color: [128, 128, 128, 0.5], width: '2px' @@ -521,7 +248,9 @@ // 重新设置地图中心点并移动 this.view.center = point - this.view.goTo(point) + console.log(this.longitude, this.latitude) + this.view.goTo([this.longitude, this.latitude]) + console.log('center', this.view.center) } } }