diff options
Diffstat (limited to 'lib/toOSM.js')
-rw-r--r-- | lib/toOSM.js | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/toOSM.js b/lib/toOSM.js index 86c08e5..409e80a 100644 --- a/lib/toOSM.js +++ b/lib/toOSM.js @@ -33,21 +33,21 @@ module.exports = (sourceFeature, options) => { // Building unit // bld_unit_* const bld_unit_1 = [ - sourceProperties.BUNIT_PRE1, - sourceProperties.BUNIT_ID1 || null, // 0 is used for an empty value in the source data, so convert 0 to null - sourceProperties.BUNIT_SUF1 - ].join('') || null + sourceProperties.BLG_UNIT_PREFIX_1, + sourceProperties.BLG_UNIT_ID_1 || null, // 0 is used for an empty value in the source data, so convert 0 to null + sourceProperties.BLG_UNIT_SUFFIX_1, + ].join("") || null; const bld_unit_2 = [ - sourceProperties.BUNIT_PRE2, - sourceProperties.BUNIT_ID2 || null, // 0 is used for an empty value in the source data, so convert 0 to null - sourceProperties.BUNIT_SUF2 - ].join('') || null + sourceProperties.BLG_UNIT_PREFIX_2, + sourceProperties.BLG_UNIT_ID_2 || null, // 0 is used for an empty value in the source data, so convert 0 to null + sourceProperties.BLG_UNIT_SUFFIX_2, + ].join("") || null; // if both 1 and 2 defined, then use a range 1-2 otherwise just select the one which was defined let bld_unit = null if (sourceProperties.HSA_FLAG === 'Y') { - bld_unit = sourceProperties.HSAUNITID + bld_unit = sourceProperties.HSA_UNIT_ID } else { if (bld_unit_1 && bld_unit_2) { bld_unit = `${bld_unit_1}-${bld_unit_2}` @@ -61,12 +61,12 @@ module.exports = (sourceFeature, options) => { if (bld_unit) { if (options && options.includeUnitPrefix) { // building unit type (Unit, Shop, Suite...) - if (sourceProperties.BLGUNTTYP) { - if (sourceProperties.BLGUNTTYP in buildingUnitType) { - outputProperties['addr:unit:prefix'] = capitalCase(buildingUnitType[sourceProperties.BLGUNTTYP]) + if (sourceProperties.BLG_UNIT_TYPE) { + if (sourceProperties.BLG_UNIT_TYPE in buildingUnitType) { + outputProperties['addr:unit:prefix'] = capitalCase(buildingUnitType[sourceProperties.BLG_UNIT_TYPE]) } else { if (options && options.debug) { - console.log(`Building Unity Type ${sourceProperties.BLGUNTTYP} not recognised for ${sourceFeature}`) + console.log(`Building Unity Type ${sourceProperties.BLG_UNIT_TYPE} not recognised for ${sourceFeature}`) } } } @@ -78,16 +78,16 @@ module.exports = (sourceFeature, options) => { // house number // house_* const house_1 = [ - sourceProperties.HSE_PREF1, - sourceProperties.HSE_NUM1 || null, // 0 is used for an empty value in the source data, so convert 0 to null - sourceProperties.HSE_SUF1 - ].join('') + sourceProperties.HOUSE_PREFIX_1, + sourceProperties.HOUSE_NUMBER_1 || null, // 0 is used for an empty value in the source data, so convert 0 to null + sourceProperties.HOUSE_SUFFIX_1, + ].join(""); const house_2 = [ - sourceProperties.HSE_PREF2, - sourceProperties.HSE_NUM2 || null, // 0 is used for an empty value in the source data, so convert 0 to null - sourceProperties.HSE_SUF2 - ].join('') + sourceProperties.HOUSE_PREFIX_2, + sourceProperties.HOUSE_NUMBER_2 || null, // 0 is used for an empty value in the source data, so convert 0 to null + sourceProperties.HOUSE_SUFFIX_2, + ].join(""); let housenumber = null if (house_1 && house_2) { @@ -111,14 +111,14 @@ module.exports = (sourceFeature, options) => { outputProperties['addr:street'] = capitalCase([ sourceProperties.ROAD_NAME, sourceProperties.ROAD_TYPE, - sourceProperties.RD_SUF in roadSuffixMap ? roadSuffixMap[sourceProperties.RD_SUF] : sourceProperties.RD_SUF + sourceProperties.ROAD_SUFFIX in roadSuffixMap ? roadSuffixMap[sourceProperties.ROAD_SUFFIX] : sourceProperties.ROAD_SUFFIX ].join(' ')) } if (options && options.includeDerivableProperties) { // every record has LOCALITY populated, however some values should be empty - if (sourceProperties.LOCALITY && !emptyNames.includes(sourceProperties.LOCALITY)) { - const suburb = capitalCase(sourceProperties.LOCALITY) + if (sourceProperties.LOCALITY_NAME && !emptyNames.includes(sourceProperties.LOCALITY_NAME)) { + const suburb = capitalCase(sourceProperties.LOCALITY_NAME) // some special cases are defined in suburbMap outputProperties['addr:suburb'] = suburb in suburbMap ? suburbMap[suburb] : suburb |