diff options
author | Andrew Harvey <andrew@alantgeo.com.au> | 2021-05-05 15:21:51 +1000 |
---|---|---|
committer | Andrew Harvey <andrew@alantgeo.com.au> | 2021-05-05 15:21:51 +1000 |
commit | 43d2090893aeeb8645e0e9c6ca05d5f96e48aae0 (patch) | |
tree | 58415e752b5f69087c7ad87d3493a64987222464 /lib/toOSM.js | |
parent | 12e26c30579407c0739fdcb0e5043b208536c8b7 (diff) |
clean up debug logging, corner cases, and set addr:unit:prefix
Diffstat (limited to 'lib/toOSM.js')
-rw-r--r-- | lib/toOSM.js | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/toOSM.js b/lib/toOSM.js index 95c387f..afa8057 100644 --- a/lib/toOSM.js +++ b/lib/toOSM.js @@ -80,8 +80,7 @@ module.exports = (sourceFeature, options) => { outputProperties['_pfi'] = sourceProperties.PFI } - // Building sub address type (eg UNIT OFFICE SHOP) - // + // Building unit // bld_unit_* const bld_unit_1 = [ sourceProperties.BUNIT_PRE1, @@ -110,15 +109,22 @@ module.exports = (sourceFeature, options) => { } if (bld_unit) { - outputProperties['addr:unit'] = bld_unit - } + // building unit type (Unit, Shop, Suite...) + // only included if a unit value is set + if (sourceProperties.BLGUNTTYP) { + if (sourceProperties.BLGUNTTYP in buildingUnitType) { + outputProperties['addr:unit:prefix'] = capitalCase(buildingUnitType[sourceProperties.BLGUNTTYP]) + } else { + if (options && options.debug) { + console.log(`Building Unity Type ${sourceProperties.BLGUNTTYP} not recognised for ${sourceFeature}`) + } + } + } - /* - if (sourceProperties.BLGUNTTYP && sourceProperties.BLGUNTTYP in buildingUnitType) { - outputProperties['addr:unit:type'] = buildingUnitType[sourceProperties.BLGUNTTYP] + outputProperties['addr:unit'] = bld_unit } - */ + // house number // house_* const house_1 = [ sourceProperties.HSE_PREF1, @@ -145,7 +151,8 @@ module.exports = (sourceFeature, options) => { outputProperties['addr:housenumber'] = housenumber } - // display numbers used predominately in the City of Melbourne CBD by large properties. Primarily to simplify an assigned number range. + // display numbers used predominately in the City of Melbourne CBD by large properties. + // Primarily to simplify an assigned number range. // so should map the assigned address or the signposted address? // every record has at least ROAD_NAME populated |