From f38029736c4d0e71f6d8c4c74ac6403859d2c0fc Mon Sep 17 00:00:00 2001 From: Ray Miller Date: Tue, 29 Dec 2020 13:24:56 +0000 Subject: [PATCH] Use just the English name for Welsh counties --- cmd/save-gob/main.go | 8 ++++++++ pkg/placenames/placenames.bin | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/save-gob/main.go b/cmd/save-gob/main.go index 73aac6c..d5d03e4 100644 --- a/cmd/save-gob/main.go +++ b/cmd/save-gob/main.go @@ -4,6 +4,7 @@ import ( "encoding/gob" "log" "os" + "strings" "github.com/ray1729/gpx-utils/pkg/openname" "github.com/ray1729/gpx-utils/pkg/placenames" @@ -31,6 +32,13 @@ func main() { Ymin: r.MbrYMin, Xmax: r.MbrXMax, 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) }, openname.FilterType("populatedPlace"), diff --git a/pkg/placenames/placenames.bin b/pkg/placenames/placenames.bin index 7537a8e..1ddfcf8 100644 --- a/pkg/placenames/placenames.bin +++ b/pkg/placenames/placenames.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:59f0ab4a708a31289ac4848669499915841c52710163dbca6231c063fe4d078b -size 2033196 +oid sha256:88279b68d8ba839190c7039b33e691d5255335787ca7abcf5eb8810b43980045 +size 1995215