Last active
January 23, 2023 20:34
-
-
Save michogar/e2ad38165b20c1db420a4a65a21987b1 to your computer and use it in GitHub Desktop.
Getting multiple features with multiple cql filters at the same time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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