fences-slicer
Advanced tools
Comparing version 0.2.3 to 0.2.4
{ | ||
"name": "fences-slicer", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Split large geojson file into smaller region files", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -14,13 +14,13 @@ var fs = require('fs-extra'); | ||
isCountry(data); | ||
data.properties['name:FENCES'] = sanitizeName(data); | ||
dedupe(data); | ||
var cleanName = sanitizeName(data); | ||
dedupe(cleanName); | ||
data = simplify(data, 0.001); | ||
names.push(data.properties['name:FENCES']); | ||
names.push(cleanName); | ||
var copy = { | ||
properties: { | ||
'name': data.properties['name:en'], | ||
'name:FENCES': data.properties['name:FENCES'] | ||
'name:display': getName(data), | ||
'name': cleanName | ||
}, | ||
@@ -42,3 +42,3 @@ geometry: data.geometry, | ||
stream.on('finish', function () { | ||
console.log('\nAll done!!!\nRegions file generated with ' + names.length + ' regions'); | ||
console.log('\nRegions file generated with ' + names.length + ' regions'); | ||
}); | ||
@@ -48,3 +48,3 @@ }; | ||
function sanitizeName(obj) { | ||
var name = obj.properties['name:en']; // || obj.properties['name']; | ||
var name = getName(obj); | ||
var clean = name.replace(/[^a-z0-9]/gi, '_').toLowerCase(); | ||
@@ -59,5 +59,9 @@ var check = name.replace(/[_]/gi, ''); | ||
function dedupe(obj) { | ||
if (names.indexOf(obj.properties['name:FENCES']) !== -1) { | ||
throw new Error('Duplicate object not added: ' + obj.properties.name); | ||
function getName(obj) { | ||
return obj.properties['name:en'] || obj.properties.name; | ||
} | ||
function dedupe(name) { | ||
if (names.indexOf(name) !== -1) { | ||
throw new Error('Duplicate object not added: ' + name); | ||
} | ||
@@ -64,0 +68,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26351809
719