Use district when county is not available.

This commit is contained in:
Ray Miller 2020-12-23 08:25:57 +00:00
parent af15ee6707
commit 88336110e0

View file

@ -26,7 +26,7 @@ func main() {
b := placenames.NamedBoundary{
Name: r.Name,
Type: r.LocalType,
County: r.CountyUnitary,
County: coalesce(r.CountyUnitary, r.DistrictBorough),
Xmin: r.MbrXMin,
Ymin: r.MbrYMin,
Xmax: r.MbrXMax,
@ -41,3 +41,12 @@ func main() {
log.Fatal(err)
}
}
func coalesce(xs ...string) string {
for _, x := range xs {
if len(x) > 0 {
return x
}
}
return ""
}