summaryrefslogtreecommitdiffstats
path: root/photon
diff options
context:
space:
mode:
authorsiddharth ravikumar <s@ricketyspace.net>2022-05-28 10:23:21 -0400
committersiddharth ravikumar <s@ricketyspace.net>2022-05-28 10:24:04 -0400
commitf0e685d2fd2219c1b4f1f7cd3a7488390ba2ab16 (patch)
tree84501e044ccb87a8f1f82b40e533e79058bd07e4 /photon
parentf3813503b748eba2877e730c53c91549ca2c6da5 (diff)
photon: update Geocode
Skip feature if a feature with the same name was added previously to mCoords.
Diffstat (limited to 'photon')
-rw-r--r--photon/photon.go6
1 files changed, 6 insertions, 0 deletions
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