aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Harvey <andrew@alantgeo.com.au>2022-05-21 16:36:13 +1000
committerAndrew Harvey <andrew@alantgeo.com.au>2022-05-21 16:36:13 +1000
commit73280f487386fdb7267221c580a3f5b754b5bd4d (patch)
treec73a8ce616060e02a89a0ae893ce19d932e9329d
parent1d94ced0ae9f5d511768e07f5c8c1a66625452e9 (diff)
only include addr:flats if not too long
-rw-r--r--README.md2
-rwxr-xr-xbin/reduceOverlap.js5
2 files changed, 5 insertions, 2 deletions
diff --git a/README.md b/README.md
index 5e6bede..ff3e314 100644
--- a/README.md
+++ b/README.md
@@ -158,7 +158,7 @@ Multiple points overlapping don't add any extra value to the OSM data and are ar
Data consumers can still easily explode `addr:flats` out into overlapping nodes with varying `addr:unit` if desired.
-Because OSM tag values are limited to 255 characters, if the constructed `addr:flats` exceeds this it is split across `addr:flats`, `addr:flats1`, etc. While not ideal I don't see any other option.
+However to avoid creating too many immediate problems, given OSM Carto will include `addr:flats` as a map label, without truncating long strings, if the flats range includes more than 3 then `addr:flats` is ommitted. This is not ideal, but is more conservative given this is a bulk import.
3. Where all the overlapping points have no units and the same street, suburb, state, postcode but different housenumbers, the housenumbers are combined into a range.
diff --git a/bin/reduceOverlap.js b/bin/reduceOverlap.js
index cc73bed..2da84ec 100755
--- a/bin/reduceOverlap.js
+++ b/bin/reduceOverlap.js
@@ -177,7 +177,10 @@ const reduce = new Transform({
this.push(retainedFeature)
} else {
const flats = unitsToRanges(allOtherUnits, argv.verbose && featureGroup)
- nonUnitFeature.properties['addr:flats'] = flats
+ // because OSM carto will render addr:flats regardless of length for the time being if there would be too many flat ranges then don't include addr:flats at all
+ if (flats.split(';').length <= 2) {
+ nonUnitFeature.properties['addr:flats'] = flats
+ }
if (nonUnitFeature.properties._pfi) {
nonUnitFeature.properties._pfi = featureGroup.map(f => f.properties._pfi).join(',')
}