Changes geocode_street signature to include city and rename state_province
This commit is contained in:
parent
f97dfceea6
commit
6bdc517a45
@ -1,12 +1,12 @@
|
||||
-- Geocodes a street address given a searchtext and a state and/or country
|
||||
CREATE OR REPLACE FUNCTION geocode_street(searchtext TEXT, state TEXT DEFAULT NULL, country TEXT DEFAULT NULL)
|
||||
CREATE OR REPLACE FUNCTION geocode_street(searchtext TEXT, city TEXT DEFAULT NULL, state_province TEXT DEFAULT NULL, country TEXT DEFAULT NULL)
|
||||
RETURNS Geometry
|
||||
AS $$
|
||||
from heremaps import heremapsgeocoder
|
||||
|
||||
geocoder = heremapsgeocoder.Geocoder(app_id, app_code)
|
||||
|
||||
results = geocoder.geocode_address(searchtext=searchtext, state=state, country=country)
|
||||
results = geocoder.geocode_address(searchtext=searchtext, city=city, state=state_province, country=country)
|
||||
coordinates = geocoder.extract_lng_lat_from_result(results[0])
|
||||
|
||||
plan = plpy.prepare("SELECT ST_SetSRID(ST_MakePoint($1, $2), 4326); ", ["double precision", "double precision"])
|
||||
|
Loading…
Reference in New Issue
Block a user