Skip to content

Commit 640a97c

Browse files
committed
Remove redundant code
1 parent b8c6251 commit 640a97c

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

src/lib/get-capabilities.js

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ return 'Unknown'
111111
// Extract from both ows:Title and Title elements for WFS
112112
const owsTitles = Array.from(wfsXml.getElementsByTagName('ows:Title')).map(el => el.textContent)
113113
const plainTitles = Array.from(wfsXml.getElementsByTagName('Title')).map(el => el.textContent)
114-
const wfsLayers = [...new Set([...owsTitles, ...plainTitles])]
114+
const wfsLayers = [ ...new Set([ ...owsTitles, ...plainTitles ]) ]
115115

116116
// Keep WCS as-is
117117
const wcsLayers = Array.from(wcsXml.getElementsByTagName('ows:Title')).map(el => el.textContent)
@@ -207,30 +207,6 @@ export function getSupportedOutputFormats(type, capabilities) {
207207

208208
}
209209

210-
/**
211-
* Determines if the layer is a raster layer
212-
*/
213-
export function isRasterLayer(type, capabilities, layer) {
214-
if (type !== 'wcs') {
215-
return false
216-
}
217-
218-
const findCoverageForLayer = id => (layers) => {
219-
id = id.replace(/:/, '__')
220-
return layers.find(layer => layer.textContent.trim() === id)
221-
}
222-
223-
const keywords = pipe(
224-
() => [ ...capabilities.querySelectorAll('CoverageId') ],
225-
findCoverageForLayer(layer),
226-
getParentNode,
227-
el => el.getElementsByTagName('ows:Keywords'),
228-
getTags('ows:Keyword'),
229-
map(getTagContent),
230-
)()
231-
232-
return keywords.includes('GeoTIFF')
233-
}
234210
async function readWmsCapabilitiesProperties(capabilities, layerObject) {
235211
/**
236212
* function that reads the wms capabilities response of the workpspace

src/views/DownloadGeoserver.vue

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
import metaRepo from '~/repo/metaRepo'
196196
import buildDownloadUrl from '~/lib/build-download-url'
197197
import { describeFeatureType, readFeatureProperties } from '~/lib/wfs-filter-helpers'
198-
import { isRasterLayer, getDataServicesCapabilities } from '~/lib/get-capabilities'
198+
import { getDataServicesCapabilities } from '~/lib/get-capabilities'
199199
200200
201201
@@ -271,15 +271,10 @@
271271
},
272272
273273
isRasterLayer() {
274-
if (!this.layerCapabilities) {
274+
if (!this.selectedLayerData) {
275275
return false
276276
}
277-
278-
return isRasterLayer(
279-
this.selectedLayerData.dataServiceType,
280-
this.layerCapabilities,
281-
this.selectedLayerData.layer,
282-
)
277+
return this.selectedLayerData.dataServiceType === 'wcs'
283278
},
284279
285280
isSelectedLayerDownloadable() {

0 commit comments

Comments
 (0)