diff options
author | Andrew Harvey <andrew@alantgeo.com.au> | 2022-03-21 14:00:52 +1100 |
---|---|---|
committer | Andrew Harvey <andrew@alantgeo.com.au> | 2022-03-21 14:00:52 +1100 |
commit | b82f38d8e81530ad47af875f91ee54c80a37fdd8 (patch) | |
tree | 5957ff56fbaab3d8a3aab2ff70c01bcca2ad17ef | |
parent | d615d1734030454bceff9970e03fe5b2efaeeaa1 (diff) |
swap to gdb source
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | lib/filterSource.js | 4 | ||||
-rw-r--r-- | lib/toOSM.js | 48 |
4 files changed, 33 insertions, 33 deletions
@@ -10,7 +10,7 @@ data/VICMAP_PROPERTY.zip: mkdir -p data wget --no-verbose --directory-prefix=data https://www.alantgeo.com.au/share/VICMAP_PROPERTY.zip -data/vicmap/ll_gda94/sde_shape/whole/VIC/VMADD/layer/address.shp: data/VICMAP_ADDRESS.zip +data/vicmap/ll_gda2020/filegdb/whole_of_dataset/victoria/VICMAP_ADDRESS.gdb: data/VICMAP_ADDRESS.zip mkdir -p data/vicmap unzip -d data/vicmap -n $< # update mtime so that Make doesn't see it as outdated @@ -25,13 +25,13 @@ data/vicmap-property.fgb: data/vicmap/ll_gda94/sde_shape/whole/VIC/VMPROP/layer/ ogr2ogr -f FlatGeobuf -nlt PROMOTE_TO_MULTI $@ $< data/vicmap.geojson: - ogr2ogr -f GeoJSONSeq $@ data/vicmap/ll_gda94/sde_shape/whole/VIC/VMADD/layer/address.shp + ogr2ogr -f GeoJSONSeq -mapFieldType DateTime=String $@ data/vicmap/ll_gda2020/filegdb/whole_of_dataset/victoria/VICMAP_ADDRESS.gdb wc -l $@ # used for quick debugging -# ogr2ogr -f GeoJSONSeq -clipsrc 144.95392 -37.80260 144.97298 -37.79204 data/vicmap.geojson data/vicmap/ll_gda94/sde_shape/whole/VIC/VMADD/layer/address.shp +# ogr2ogr -f GeoJSONSeq -clipsrc 144.95392 -37.80260 144.97298 -37.79204 data/vicmap.geojson data/vicmap/ll_gda2020/filegdb/whole_of_dataset/victoria/VICMAP_ADDRESS.gdb vicmapExtract: - ogr2ogr -f GeoJSONSeq -clipsrc 144.95366 -37.80284 145.00272 -37.77482 data/vicmap.geojson data/vicmap/ll_gda94/sde_shape/whole/VIC/VMADD/layer/address.shp + ogr2ogr -f GeoJSONSeq -mapFieldType DateTime=String -clipsrc 144.95366 -37.80284 145.00272 -37.77482 data/vicmap.geojson data/vicmap/ll_gda2020/filegdb/whole_of_dataset/victoria/VICMAP_ADDRESS.gdb cleanDist: rm -rf dist @@ -80,14 +80,14 @@ dist/canidates.geojson: dist/vicmap-osm-uniq-flats-withinrange.geojson loadPgOSM: dist/vicmap-osm.geojson ogr2ogr -f PostgreSQL PG: $< -lco UNLOGGED=YES -nln vm_osm -data/vicmap.fgb: data/vicmap/ll_gda94/sde_shape/whole/VIC/VMADD/layer/address.shp +data/vicmap.fgb: data/vicmap/ll_gda2020/filegdb/whole_of_dataset/victoria/VICMAP_ADDRESS.gdb ogr2ogr -f FlatGeobuf $@ $< dist/vicmap-osm.fgb: dist/vicmap-osm.geojson ogr2ogr -f FlatGeobuf $@ $< # useful for development to be able to query a database -loadPgAdd: data/vicmap/ll_gda94/sde_shape/whole/VIC/VMADD/layer/address.shp +loadPgAdd: data/vicmap/ll_gda2020/filegdb/whole_of_dataset/victoria/VICMAP_ADDRESS.gdb ogr2ogr -f PostgreSQL PG: $< -nln vmadd # index all columns for faster queries during development psql -f src/createIndexQuery.sql --tuples-only | psql @@ -26,7 +26,7 @@ We use GitLab CI/CD to automate data processing. Download source Vicmap data (_prepare_ stage): - make data/vicmap/ll_gda94/sde_shape/whole/VIC/VMADD/layer/address.shp + make data/vicmap/ll_gda2020/filegdb/whole_of_dataset/victoria/VICMAP_ADDRESS.gdb Convert to GeoJSON (_prepare_ stage): diff --git a/lib/filterSource.js b/lib/filterSource.js index af535bf..1527045 100644 --- a/lib/filterSource.js +++ b/lib/filterSource.js @@ -26,8 +26,8 @@ const buildingUnitTypeWhitelist = [ module.exports = (feature) => { // if the address has a building unit type, only allow a few whitelisted types - if ('BLGUNTTYP' in feature.properties && feature.properties.BLGUNTTYP !== null) { - if (buildingUnitTypeWhitelist.includes(feature.properties.BLGUNTTYP)) { + if ('BLG_UNIT_TYPE' in feature.properties && feature.properties.BLG_UNIT_TYPE !== null) { + if (buildingUnitTypeWhitelist.includes(feature.properties.BLG_UNIT_TYPE)) { // building unit type in the whitelist, include feature return true } else { 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 |