|
@@ -185,6 +185,16 @@ public final class GeoIpProcessor extends AbstractProcessor {
|
|
|
geoData.put("continent_name", continentName);
|
|
|
}
|
|
|
break;
|
|
|
+ case REGION_ISO_CODE:
|
|
|
+ // ISO 3166-2 code for country subdivisions.
|
|
|
+ // See iso.org/iso-3166-country-codes.html
|
|
|
+ String countryIso = country.getIsoCode();
|
|
|
+ String subdivisionIso = subdivision.getIsoCode();
|
|
|
+ if (countryIso != null && subdivisionIso != null) {
|
|
|
+ String regionIsoCode = countryIso + "-" + subdivisionIso;
|
|
|
+ geoData.put("region_iso_code", regionIsoCode);
|
|
|
+ }
|
|
|
+ break;
|
|
|
case REGION_NAME:
|
|
|
String subdivisionName = subdivision.getName();
|
|
|
if (subdivisionName != null) {
|
|
@@ -300,8 +310,8 @@ public final class GeoIpProcessor extends AbstractProcessor {
|
|
|
|
|
|
public static final class Factory implements Processor.Factory {
|
|
|
static final Set<Property> DEFAULT_CITY_PROPERTIES = EnumSet.of(
|
|
|
- Property.CONTINENT_NAME, Property.COUNTRY_ISO_CODE, Property.REGION_NAME,
|
|
|
- Property.CITY_NAME, Property.LOCATION
|
|
|
+ Property.CONTINENT_NAME, Property.COUNTRY_ISO_CODE, Property.REGION_ISO_CODE,
|
|
|
+ Property.REGION_NAME, Property.CITY_NAME, Property.LOCATION
|
|
|
);
|
|
|
static final Set<Property> DEFAULT_COUNTRY_PROPERTIES = EnumSet.of(
|
|
|
Property.CONTINENT_NAME, Property.COUNTRY_ISO_CODE
|
|
@@ -377,6 +387,7 @@ public final class GeoIpProcessor extends AbstractProcessor {
|
|
|
COUNTRY_ISO_CODE,
|
|
|
COUNTRY_NAME,
|
|
|
CONTINENT_NAME,
|
|
|
+ REGION_ISO_CODE,
|
|
|
REGION_NAME,
|
|
|
CITY_NAME,
|
|
|
TIMEZONE,
|
|
@@ -386,7 +397,8 @@ public final class GeoIpProcessor extends AbstractProcessor {
|
|
|
|
|
|
static final EnumSet<Property> ALL_CITY_PROPERTIES = EnumSet.of(
|
|
|
Property.IP, Property.COUNTRY_ISO_CODE, Property.COUNTRY_NAME, Property.CONTINENT_NAME,
|
|
|
- Property.REGION_NAME, Property.CITY_NAME, Property.TIMEZONE, Property.LOCATION
|
|
|
+ Property.REGION_ISO_CODE, Property.REGION_NAME, Property.CITY_NAME, Property.TIMEZONE,
|
|
|
+ Property.LOCATION
|
|
|
);
|
|
|
static final EnumSet<Property> ALL_COUNTRY_PROPERTIES = EnumSet.of(
|
|
|
Property.IP, Property.CONTINENT_NAME, Property.COUNTRY_NAME, Property.COUNTRY_ISO_CODE
|