|
@@ -13,7 +13,7 @@ import { GeoServerQuery } from '@/utils/arcgis-map-server-query'
|
|
|
import html2canvas from 'html2canvas'
|
|
|
import { GeoJSON } from 'ol/format'
|
|
|
import { Geometry as WkxGeometry } from 'wkx'
|
|
|
-
|
|
|
+import { getCenter } from 'ol/extent'
|
|
|
const klyzyMap = window.ApplicationConfig.klyzyurl
|
|
|
const kfqMap = window.ApplicationConfig.kfqurl
|
|
|
const xzqZjMap = window.ApplicationConfig.xzq_zjurl
|
|
@@ -195,10 +195,9 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
queryYq(geo, resolve, reject) {
|
|
|
- const wkt = WkxGeometry.parseGeoJSON(
|
|
|
- geo
|
|
|
- ).toWkt()
|
|
|
-
|
|
|
+ const yqGeo = new GeoJSON().readGeometry(geo)
|
|
|
+ const extent = yqGeo.getExtent()
|
|
|
+ const center = getCenter(extent)
|
|
|
try {
|
|
|
const sendData = {
|
|
|
service: 'WFS',
|
|
@@ -207,7 +206,7 @@ export default {
|
|
|
typeName: kfqMap.params.layers,
|
|
|
maxFeatures: '1',
|
|
|
outputFormat: 'application/json',
|
|
|
- cql_filter: `INTERSECTS(shape, ${wkt})`
|
|
|
+ cql_filter: `CONTAINS(shape, POINT(${center[0]} ${center[1]}))`
|
|
|
}
|
|
|
axios.get(`${kfqMap.queryUrl}/ows`, { params: sendData }, { timeout: 3 * 60 * 1000 }).then(data => {
|
|
|
resolve(data)
|
|
@@ -217,9 +216,10 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
queryXzq(geo, resolve, reject) {
|
|
|
- const wkt = WkxGeometry.parseGeoJSON(
|
|
|
- geo
|
|
|
- ).toWkt()
|
|
|
+ const xzqGeo = new GeoJSON().readGeometry(geo)
|
|
|
+ const extent = xzqGeo.getExtent()
|
|
|
+ const center = getCenter(extent)
|
|
|
+
|
|
|
try {
|
|
|
const _default = {
|
|
|
service: 'WFS',
|
|
@@ -228,7 +228,7 @@ export default {
|
|
|
typeName: xzqZjMap.params.layers,
|
|
|
maxFeatures: '1',
|
|
|
outputFormat: 'application/json',
|
|
|
- cql_filter: `INTERSECTS(shape, ${wkt})`
|
|
|
+ cql_filter: `CONTAINS(shape, POINT(${center[0]} ${center[1]}))`
|
|
|
}
|
|
|
axios.get(`${xzqZjMap.queryUrl}/ows`, { params: _default }, { timeout: 3 * 60 * 1000 }).then(data => {
|
|
|
resolve(data)
|