Skip to content

Instantly share code, notes, and snippets.

@michogar
Last active January 23, 2023 20:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michogar/e2ad38165b20c1db420a4a65a21987b1 to your computer and use it in GitHub Desktop.
Save michogar/e2ad38165b20c1db420a4a65a21987b1 to your computer and use it in GitHub Desktop.
Getting multiple features with multiple cql filters at the same time
const axios = require('axios')
const geosolutions = 'https://demo.geo-solutions.it/geoserver'
const URL = (typeNames, cqlFilter, propertyName) => `${geosolutions}/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&typeNames=${typeNames}&propertyName=${propertyName}&cql_filter=${cqlFilter}&outputFormat=application/json`
const typeNames = '(topp:tasmania_water_bodies)(topp:tasmania_roads)'
const cqlFilter = `AREA<1066494066;TYPE='alley'`
const propertyName = '(CNTRY_NAME)(TYPE)'
const wfs = URL(typeNames, cqlFilter, propertyName)
console.info(`Requesting WFS to ${wfs}`)
axios.get(wfs).then((response) => {
console.log(response.data)
}).catch(err => console.error(err.response.data))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment