Open mtimofiiv opened 5 years ago
From what I can tell, this plugin does fine-grained interpretation of what data can be deemed "City":
isCity() {
return this.isType(['locality', 'sublocality', 'political', 'sublocality_level_1', 'sublocality_level_2', 'sublocality_level_3', 'sublocality_level_4', 'sublocality_level_5']);
}
So getting city
as null
likely means that that particular place really is exceptional, if it doesn't have anything for all those fields.
Maybe this is a case of city-states, like Washington DC or The Vatican; am I using the right analogy?
In any case, perhaps it should not matter, because in your application, for safety, you should build in a condition to handle this. If there's no city result, then fallback to state?
This plugin has a function using administrative_area_level_1
:
isState() {
return this.isType(['administrative_area_level_1']);
}
Hello! This is more of an issue with how Google tags its locations than this module, but it does have sometimes inconsistent behaviour when it comes to getting city names.
The reason is that
locality
orsublocality
is not always present. Take for example the following GPS coords:This set of coords is smack in the middle of Da Nang city in Vietnam. I posted the result set below (filtered for
locality
since those are the relevant ones), so you can see there's nolocality
set on it. However, it seems theadministrative_area_level_1
/political
result has that info in it.To be honest I am not sure how many places are affected, but searching coordinates in Ho Chi Minh City yielded the same results: no
locality
, onlyadministrative_area_level_1
/political
having the name of the city in it.Obviously I can't expect this module to fix something in Google's tagging mechanism but it might be nice to brainstorm what can be done here instead?
Now the reason for this might be that Da Nang is also technically the province name as well.