Add search type filter for Mapzen geocoder

This commit is contained in:
Mario de Frutos
2016-08-29 14:32:49 +02:00
parent 06462fdf7a
commit 18ae2525b6
2 changed files with 3 additions and 2 deletions

View File

@@ -159,7 +159,7 @@ RETURNS Geometry AS $$
country_iso3 = country_to_iso3(country)
coordinates = geocoder.geocode(searchtext=searchtext, city=city,
state_province=state_province,
country=country_iso3)
country=country_iso3, search_type='address')
if coordinates:
quota_service.increment_success_service_use()
plan = plpy.prepare("SELECT ST_SetSRID(ST_MakePoint($1, $2), 4326); ", ["double precision", "double precision"])

View File

@@ -54,8 +54,9 @@ class MapzenGeocoder:
city,
state_province)
request_params['text'] = search_string
request_params['layers'] = search_type if search_type else 'address'
request_params['api_key'] = self._app_key
if search_type:
request_params['layers'] = search_type
if country:
request_params['boundary.country'] = country
return request_params