Skip to content

Commit 04b65d7

Browse files
committed
fall back to GU_A3
1 parent e3d9883 commit 04b65d7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rgeo.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,15 @@ func firstNonEmpty(s ...string) string {
202202

203203
// Get the relevant strings from the GeoJSON properties.
204204
func getLocationStrings(p map[string]interface{}) Location {
205+
countryCode3 := getPropertyString(p, "ISO_A3")
206+
if countryCode3 == "-99" {
207+
countryCode3 = getPropertyString(p, "GU_A3")
208+
}
205209
return Location{
206210
Country: getPropertyString(p, "ADMIN", "admin"),
207211
CountryLong: getPropertyString(p, "FORMAL_EN"),
208212
CountryCode2: getPropertyString(p, "ISO_A2"),
209-
CountryCode3: getPropertyString(p, "ISO_A3"),
213+
CountryCode3: countryCode3,
210214
Continent: getPropertyString(p, "CONTINENT"),
211215
Region: getPropertyString(p, "REGION_UN"),
212216
SubRegion: getPropertyString(p, "SUBREGION"),

0 commit comments

Comments
 (0)