✨ Instagram integration is live! Tutorial

Convert Latitude & Longitude to Address in Airtable using Google Maps API

Nov 9, 2022Rosie Threlfall

In this easy-to-follow tutorial, we'll take a set of latitude and longitude coordinates and convert them into addresses in Airtable.

We'll use the Google Maps Geocoding API and the Data Fetcher Airtable extension. To do this we'll need to create a Google Maps Geocoding API key and there is no need to use any code.

You can also use Data Fetcher to find out the latitude and longitude of an address and import this into Airtable.

Create Latitude Longitude Table

In Airtable, create two new fields called 'Latitude' and 'Longitude' with type 'Number', set the Precision to 1.0000000.

LatitudeLongitude10.jpg

In the 'Latitude' and 'Longitude' fields, add the coordinates of the location you want to look up the address for.

LatitudeLongitude.jpg

Create a new Grid view in your table called 'Needs address' with the following filters:

The 'Latitude' field is not empty.
The 'Longitude' field is not empty.

LatitudeLongitude2.jpg

Get a Google Maps Geocoding API Key

To use the Google Maps Platform APIs, you need to set up a Google Cloud project. Follow these steps to create a project with a billing account.

After creating your account, you'll be given an API key. Or find your Google Maps API key here.

To convert latitude and longitude to addresses, we will use the Geocoding API. This is a paid feature from Google, please read this page to understand the costs involved with the Geocoding API.

Install Data Fetcher

Install Data Fetcher from the Airtable marketplace. You can either sign up for a free Data Fetcher account or, if you already have one, sign in using the 'Have an account?' option in the bottom left of the box. You can also sign in using your Google account.

Group 1Data Fetcher Sign Up .png

Convert Latitude and Longitude to Addresses in Airtable

On the home screen of the Data Fetcher extension, click 'Create your first request'. Requests in Data Fetcher enable you to import data to and from external applications or APIs into Airtable.

click-create-your-first-request.png

On the create request screen in Data Fetcher, for Application, select 'Google Maps'.

google-maps-application-selected.png

Next, enter your API Key (see previous step to find this).

google-maps-authorization-api-key.png

For Endpoint, select 'Reverse geocode - find address from latitude/ longitude'.

LatitudeLongitude3.jpg

Enter a Name for your request, e.g. 'Find Address'. Then click 'Save & Continue'.

LatitudeLongitude4.jpg

For Latitude click the + button in order to create a reference to the output table.

LatitudeLongitude5.jpg

Select your output Table, the 'Latitude' Field and for Run every record select 'Needs address'.

Click 'Confirm'.

LatitudeLongitude7.jpg

Do the same for 'Longitude', and you'll see both fields referenced here. Click 'Save & Run'.

LatitudeLongitude8.jpg

Data Fetcher will send the request to the Google Maps Geocoding API,and the Response field mapping window will open. You can now set specific fields to import from Google Maps into Airtable. For an imported field, you can set whether to map to an existing field or create a new one. You can also choose which field type to create. 

Use the 'Filter all' button to clear the pre-selected fields, then use the 'Find field' search bar to find the fields you would like to import. For this example, we will import the 'Results formatted address' and map it to a new field which we'll call 'Address'.

Click 'Save & Run'.

LatitudeLongitude9.jpg

Data Fetcher will now create the new 'Address' field in the output table, run the request to the Google Maps API and populate this field with the addresses of the coordinates you entered.

LatitudeLongitude11.jpg

Automatic Google Maps Geocoding API to Airtable Integration

Currently, you'd need to manually run the Data Fetcher request every time new coordinates were added to Airtable in order to convert them to an address. With Data Fetcher's paid version, scheduling this request to run on regular intervals is possible. To upgrade your account, In Data Fetcher, scroll to Schedule and click 'Upgrade'.

schedule1.jpg

Choose a plan from the different options and enter your payment details.

data fetcher upgrade options

Back in Data Fetcher, click 'I've done this'.

schedule2.jpg

Click 'Add API key' and copy and paste your Airtable API key. You can find your Airtable API key here.

Group 11(1).png

Enter your Airtable API key and click 'Save'.

save-airtable-api-key.png

Toggle Schedule this request to on.

schedule-data-fetcher-request.png

Select a schedule for the Google Maps Geocoding API Airtable integration to run. You can choose intervals of 'Minutes', 'Hours', 'Days' or 'Months', then Click 'Save'.

Any new coordinates added to Airtable with now be automatically converted into addresses on your chosen schedule.

schedule-a-sequence-intervals.png