Skip to content

Instantly share code, notes, and snippets.

@michogar

michogar/index.js

Last active Sep 3, 2018
Embed
What would you like to do?
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