Use district when county is not available.
This commit is contained in:
parent
af15ee6707
commit
88336110e0
1 changed files with 10 additions and 1 deletions
|
@ -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 ""
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue