Carry out the following steps:
- As the first test, open your favorite SQL client (psql or pgAdmin), and write a very basic PL/Python function, just using the GoogleV3 geocoding API with geopy. The function will accept the address string as an input parameter and, after importing geopy, it will instantiate a geopy Google Geocoder, run the geocode process, and then return the point geometry, using the ST_GeomFromText function and the geopy output:
CREATE OR REPLACE FUNCTION chp08.Geocode(address text) RETURNS geometry(Point,4326) AS $$ from geopy import geocoders g = geocoders.GoogleV3() place, (lat, lng) = g.geocode(address) plpy.info('Geocoded %s for the address: %s' % (place, address)) plpy.info('Longitude is %s, Latitude ...