wind_tool_standortpruefung/debug_planning_zip.cjs

30 lines
1.1 KiB
JavaScript

global.self = global;
const fs = require('fs');
// const shp = require('shpjs'); // Removed
const ZIP_PATH = 'public/daten/Windenergiebereiche_NRW.zip';
(async () => {
try {
const { default: shp } = await import('shpjs');
console.log("Reading Zip...");
const buffer = fs.readFileSync(ZIP_PATH);
// shpjs (default export handle)
const geojson = await shp(buffer);
if (Array.isArray(geojson)) {
console.log("Found multiple features/files:", geojson.length);
geojson.forEach(g => console.log(" - File:", g.fileName || 'unknown', "Features:", g.features.length));
} else {
console.log("Found single FeatureCollection. Features:", geojson.features.length);
if (geojson.features.length > 0) {
console.log("First feature geometry type:", geojson.features[0].geometry.type);
console.log("First coordinate:", JSON.stringify(geojson.features[0].geometry.coordinates[0][0][0]));
}
}
} catch (e) {
console.error("Error parsing ZIP:", e.message);
}
})();