countryRegion method
Returns the country feature containing loc
, if any.
Implementation
RegionFeature? countryRegion(double lon, double lat) {
final region = smallestRegion(lon, lat);
if (region == null) return null;
// a feature without `country` but with geometry is itself a country
final countryCode = region.country ?? region.iso1A2;
return regionsByCode[countryCode];
}