feat: check countries polygons

This commit is contained in:
Artemy 2023-07-05 15:46:25 +03:00
parent 0431260e02
commit b6fa1f5d3d
3 changed files with 12 additions and 3 deletions

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "cimengine-build-tools", "name": "cimengine-build-tools",
"version": "1.1.3", "version": "1.2.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "cimengine-build-tools", "name": "cimengine-build-tools",
"version": "1.1.3", "version": "1.2.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@turf/turf": "^6.5.0", "@turf/turf": "^6.5.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "cimengine-build-tools", "name": "cimengine-build-tools",
"version": "1.1.4", "version": "1.2.0",
"description": "Geojson data processing tools for CIMEngine", "description": "Geojson data processing tools for CIMEngine",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View file

@ -42,6 +42,15 @@ for (country of layers) {
) )
); );
co_features.features = co_features.features.map((val) => {
if (val.geometry.type == "Polygon") {
val.properties = {};
} else if (val.geometry.type == "MultiPolygon") {
console.error("Error: MultiPolygons are not allowed!");
process.exit(1);
}
});
fs.writeFileSync( fs.writeFileSync(
path.join(geofixConf.countries, `${country}.geojson`), path.join(geofixConf.countries, `${country}.geojson`),
JSON.stringify(co_features, null, " ") JSON.stringify(co_features, null, " ")