31 lines
1.3 KiB
JavaScript
31 lines
1.3 KiB
JavaScript
// import fetch from 'node-fetch'; // Built-in in Node 18+
|
|
|
|
async function checkCaps() {
|
|
try {
|
|
console.log("Checking Roads...");
|
|
const resRoads = await fetch('http://localhost:5173/api/wfs/roads?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetCapabilities');
|
|
const textRoads = await resRoads.text();
|
|
console.log("Roads Caps Length:", textRoads.length);
|
|
// Extract FeatureTypes and OutputFormats
|
|
if (textRoads.includes('FeatureType')) {
|
|
const types = textRoads.match(/<FeatureType>[\s\S]*?<Name>(.*?)<\/Name>/g) || [];
|
|
console.log("Roads Layers:", types.map(t => t.match(/<Name>(.*?)<\/Name>/)[1]));
|
|
}
|
|
|
|
console.log("\nChecking Sites...");
|
|
const resSites = await fetch('http://localhost:5173/api/nrw/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetCapabilities');
|
|
const textSites = await resSites.text();
|
|
console.log("Sites Caps Length:", textSites.length);
|
|
if (textSites.includes('FeatureType')) {
|
|
// Just find OutputFormats
|
|
const formats = textSites.match(/<ows:Operation name="GetFeature">[\s\S]*?<ows:Parameter name="outputFormat">([\s\S]*?)<\/ows:Parameter>/);
|
|
if (formats) console.log("Sites Formats:", formats[1]);
|
|
}
|
|
|
|
} catch (e) {
|
|
console.error(e);
|
|
}
|
|
}
|
|
|
|
checkCaps();
|