From f0e685d2fd2219c1b4f1f7cd3a7488390ba2ab16 Mon Sep 17 00:00:00 2001 From: siddharth ravikumar Date: Sat, 28 May 2022 10:23:21 -0400 Subject: photon: update Geocode Skip feature if a feature with the same name was added previously to mCoords. --- photon/photon.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'photon') diff --git a/photon/photon.go b/photon/photon.go index 7dee4c5..046a8de 100644 --- a/photon/photon.go +++ b/photon/photon.go @@ -108,6 +108,7 @@ func Geocode(location string) ([]Coordinates, error) { } // Make matching coordinates list. + names := map[string]bool{} for _, feature := range r.Features { if feature.Properties.CountryCode != "US" { continue // skip @@ -120,6 +121,11 @@ func Geocode(location string) ([]Coordinates, error) { feature.Properties.Name, feature.Properties.State, ) + if names[c.Name] { + continue // skip. + } + names[c.Name] = true + mCoords = append(mCoords, c) } return mCoords, nil -- cgit v1.2.3