Use just the English name for Welsh counties

This commit is contained in:
Ray Miller 2020-12-29 13:24:56 +00:00
parent e407cf308e
commit f38029736c
2 changed files with 10 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import (
"encoding/gob" "encoding/gob"
"log" "log"
"os" "os"
"strings"
"github.com/ray1729/gpx-utils/pkg/openname" "github.com/ray1729/gpx-utils/pkg/openname"
"github.com/ray1729/gpx-utils/pkg/placenames" "github.com/ray1729/gpx-utils/pkg/placenames"
@ -31,6 +32,13 @@ func main() {
Ymin: r.MbrYMin, Ymin: r.MbrYMin,
Xmax: r.MbrXMax, Xmax: r.MbrXMax,
Ymax: r.MbrYMax} Ymax: r.MbrYMax}
// Welsh counties have both the Welsh and English name separated by a dash. Return
// just the English name.
i := strings.Index(b.County, " - ")
if i > 0 {
b.County = b.County[i+3:]
}
//fmt.Println(strings.Join([]string{b.Name, b.Type, b.County}, ","))
return enc.Encode(b) return enc.Encode(b)
}, },
openname.FilterType("populatedPlace"), openname.FilterType("populatedPlace"),

BIN
pkg/placenames/placenames.bin (Stored with Git LFS)

Binary file not shown.