diff --git a/utils/mapit.py b/utils/mapit.py index bc55753e3..82e51acb3 100644 --- a/utils/mapit.py +++ b/utils/mapit.py @@ -84,6 +84,15 @@ def wgs84_point_to_gss_codes(self, lon, lat): gss_codes.append(area["codes"]["gss"]) return gss_codes + def wgs84_point_to_gss_codes_with_type(self, lon, lat): + url = self.wgs84_url % (self.base, lon, lat, settings.MAPIT_API_KEY) + data = self.get(url) + gss_codes = {} + for area in data.values(): + if "gss" in area["codes"]: + gss_codes[area["type"]] = area["codes"]["gss"] + return gss_codes + def areas_of_type(self, types): url = self.areas_url % (self.base, ",".join(types), settings.MAPIT_API_KEY) data = self.get(url)