|
@@ -864,41 +864,46 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- async locationFeatureWhere(layerId, where, setting, isFit) {
|
|
|
+ async locationFeatureWhere(layerId, where, setting) {
|
|
|
this.spinShow = true;
|
|
|
const layerById = this.$refs.configLayer.getLayerConfigById(layerId);
|
|
|
- await arcgisQuery(
|
|
|
- `${layerById.url}/${this.layerIndex}/query`,
|
|
|
- {
|
|
|
- outSR: getSrid(this.map),
|
|
|
- where,
|
|
|
- ...setting,
|
|
|
- },
|
|
|
- true,
|
|
|
- ).then(({ features }) => {
|
|
|
- let feature = features[0];
|
|
|
- const geometry = feature.getGeometry();
|
|
|
- const wkt = WkxGeometry.parseGeoJSON(
|
|
|
- new GeoJSON().writeGeometryObject(geometry),
|
|
|
- ).toWkt();
|
|
|
- feature.set('wkt', wkt);
|
|
|
- this.feature = feature;
|
|
|
- console.log(isFit);
|
|
|
- console.log(geometry);
|
|
|
- console.log(geometry.getExtent());
|
|
|
- // if (isFit) {
|
|
|
- setTimeout(() => {
|
|
|
- let [width, height] = this.map.getSize();
|
|
|
- width = Math.ceil(width / 5);
|
|
|
- height = Math.ceil(height / 5);
|
|
|
- this.map.getView().fit(geometry.getExtent(), {
|
|
|
- padding: [height, width, height + 340, width],
|
|
|
- duration: 500,
|
|
|
- maxZoom: 18,
|
|
|
- });
|
|
|
- }, 500);
|
|
|
- // }
|
|
|
- });
|
|
|
+ if (layerById.serverType === 'wms') {
|
|
|
+ await GeoServerQuery(`${layerById.queryUrl}`, {
|
|
|
+ typeName: layerById.params.layers,
|
|
|
+ cql_filter: where
|
|
|
+ }, true).then(({ features }) => {
|
|
|
+ this.feature = features[0]
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ await arcgisQuery(
|
|
|
+ `${layerById.url}/${this.layerIndex}/query`,
|
|
|
+ {
|
|
|
+ outSR: getSrid(this.map),
|
|
|
+ where,
|
|
|
+ ...setting,
|
|
|
+ },
|
|
|
+ true
|
|
|
+ ).then(({ features }) => {
|
|
|
+ let feature = features[0];
|
|
|
+ this.feature = feature;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ const geometry = this.feature.getGeometry();
|
|
|
+ const wkt = WkxGeometry.parseGeoJSON(
|
|
|
+ new GeoJSON().writeGeometryObject(geometry)
|
|
|
+ ).toWkt();
|
|
|
+ this.feature.set("wkt", wkt);
|
|
|
+ setTimeout(() => {
|
|
|
+ let [width, height] = this.map.getSize();
|
|
|
+ width = Math.ceil(width / 5);
|
|
|
+ height = Math.ceil(height / 5);
|
|
|
+ this.map.getView().fit(geometry.getExtent(), {
|
|
|
+ padding: [height, width, height + 340, width],
|
|
|
+ duration: 500,
|
|
|
+ maxZoom: 18,
|
|
|
+ });
|
|
|
+ }, 500);
|
|
|
+
|
|
|
this.spinShow = false;
|
|
|
},
|
|
|
async locationMaskFeatureHttp(
|
|
@@ -952,19 +957,34 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
this.spinShow = true;
|
|
|
- await arcgisQuery(
|
|
|
- `${layerById.url}/0/query`,
|
|
|
- {
|
|
|
- outSR: getSrid(this.map),
|
|
|
- where,
|
|
|
- },
|
|
|
- false,
|
|
|
- ).then((resp) => {
|
|
|
- const { features } = resp;
|
|
|
- let json = { type: 'FeatureCollection', features: [] };
|
|
|
- json.features.push(convertRingsToGeoJSON(features[0].geometry.rings));
|
|
|
- MapUtils.drawShade(this.map, json);
|
|
|
- });
|
|
|
+
|
|
|
+ if (layerById.serverType === 'wms') {
|
|
|
+ await GeoServerQuery(`${layerById.queryUrl}`, {
|
|
|
+ typeName: layerById.params.layers,
|
|
|
+ cql_filter: where
|
|
|
+ }, false).then((resp) => {
|
|
|
+ const { features } = resp;
|
|
|
+ const json = { type: 'FeatureCollection', features: [] };
|
|
|
+ json.features.push(
|
|
|
+ features[0].geometry
|
|
|
+ );
|
|
|
+ MapUtils.drawShade(this.map, json);
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ await arcgisQuery(
|
|
|
+ `${layerById.url}/0/query`,
|
|
|
+ {
|
|
|
+ outSR: getSrid(this.map),
|
|
|
+ where,
|
|
|
+ },
|
|
|
+ false,
|
|
|
+ ).then((resp) => {
|
|
|
+ const { features } = resp;
|
|
|
+ let json = { type: 'FeatureCollection', features: [] };
|
|
|
+ json.features.push(convertRingsToGeoJSON(features[0].geometry.rings));
|
|
|
+ MapUtils.drawShade(this.map, json);
|
|
|
+ });
|
|
|
+ }
|
|
|
this.spinShow = false;
|
|
|
},
|
|
|
mapLoaded(map) {
|
|
@@ -1509,11 +1529,6 @@ export default {
|
|
|
this.enabledLayersConfig = enabledLayersConfig;
|
|
|
},
|
|
|
async pickServerFeature(e) {
|
|
|
- console.log(
|
|
|
- this.visibleLayerId,
|
|
|
- typeof this.visibleLayerId,
|
|
|
- 'typeof this.visibleLayerId',
|
|
|
- );
|
|
|
let tempLayerIds = this.visibleLayerIds.filter(
|
|
|
(it) =>
|
|
|
it !== 'xzqh-s' &&
|
|
@@ -1729,7 +1744,6 @@ export default {
|
|
|
'areaList',
|
|
|
features.flat().map((i) => i.attributes.FULLNAME.substr(3)),
|
|
|
);
|
|
|
- console.log(drawFeature, features, 'Promise all resp');
|
|
|
this.drawFeature = drawFeature;
|
|
|
});
|
|
|
},
|