Geocoding Addresses

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

Introduction

In this tutorial, you will learn how to geocode addresses using the Forward and Reverse Geocoding Modes in the Geocoder transformer. In Exercise 1, you will use the Forward Mode by reading a spreadsheet that contains a list of schools with the address attributes in a single column. Similarly, in Exercise 2, you will use the Reverse Mode by reading a spreadsheet that contains a list of schools with the corresponding latitude and longitude coordinates to derive the address information.

Step-by-step Instructions

Exercise 1: Forward Geocoding

In this scenario, you will be geocoding using the address attribute from an Excel file for deriving X and Y coordinates in the LL84 coordinate system. This tutorial will utilize the OpenStreetMaps geocoding service to obtain the lat/long coordinates for schools in Vancouver.

Source
The source dataset is a Microsoft Excel file containing school addresses for the City of Vancouver. 
Input1.png
 
1. Create a New Workspace
Open FME Workbench and create a blank workspace. 
NewWorkspace.png
 
2. Add a Microsoft Excel Reader
Add a Microsoft Excel reader to the canvas by clicking on the Reader button on the top menu bar or by going to Readers > Add Reader. In the Add Reader dialog, select Microsoft Excel as the Format, then for Dataset, browse to the SchoolAddresses.xlsx dataset, which is available for download from the Files section on this article. 
SchoolsReader.png
 
The Excel Workbook contains three attribute columns: School Name, School Category, and Address. You will use the Address column to geocode the schools and obtain their coordinates in the LL84 coordinate system.
 
3. Forward Geocode
Click on the SchoolAddress reader feature type to select it.  Then add a Geocoder transformer to the canvas by typing “Geocoder” to bring up the list of FME Transformers in the Quick Add Search. Select the Geocoder from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it. 
QuickAdd1.png
Connection1.png
 
Double-click on the Geocoder to open the parameters. In the parameters change Geocoding Service to OpenStreetMap. Then ensure that the Mode is set to Forward and for Street Address select the ADDRESS attribute. 
Geocoder1.png
 
For more information on the geocoding services available in the Geocoder package, see the Geocoder Documentation. Additionally, many services have restrictions on how their results may be used or displayed and may produce different address formats. Check with your chosen service for terms and conditions.
 
4. Run Workspace 
Add an Inspector to the canvas and connect it to the Geocoder Output port. Additionally, connect a Logger to the Geocoder <Rejected> output port. If any of the addresses can’t be found by the geocoding service, we want to log them via the Logger and continue the translation. 
Workspace.png
 
Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar. 
Run.png

 
After running the workspace, in Visual Preview, there will be point features of all the schools, their addresses, and Lat/Long. 
Output.png

There were 34 addresses that were Rejected. These may have been rejected due to spelling or address format. 
FeatureCounts.png
 

Exercise 2: Reverse Geocoding

In this scenario, you will be geocoding using the latitude and longitude attributes from a JSON file to derive postal address information. This tutorial will utilize the OpenStreetMaps geocoding service to obtain school addresses in the Vancouver area.

Source
The source dataset is a JSON file containing latitude and longitude locations for schools in Vancouver. 
Input2.png
 
1. Create a New Workspace
Open FME Workbench and create a blank workspace. 
NewWorkspace.png
 
2. Add a JSON (JavaScript Objection Notation) Reader
Add a JSON (JavaScript Objection Notation) reader to the canvas by clicking on the Reader button on the top menu bar or by going to Readers > Add Reader. In the Add Reader dialog, select JSON (JavaScript Objection Notation) as the Format, then for Dataset, browse to the SchoolCoords.json dataset, which is available for download from the Files section on this article. 
 JsonReader.png

3. Reverse Geocode
Click on the SchoolCoords reader feature type to select it.  Then add a Geocoder transformer to the canvas by typing “Geocoder” to bring up the list of FME Transformers in the Quick Add Search. Select the Geocoder from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it. 
QuickAdd2.png

 
Double-click on the Geocoder to open the parameters. In the parameters change Geocoding Service to OpenStreetMap. Then change Mode to Reverse, and set the Latitude and Longitude parameters to their matching attributes.
 Geocoder2.png
 
4. Run Workspace 
Add an Inspector to the canvas and connect it to the Geocoder Output port. Additionally, connect a Logger to the Geocoder <Rejected> output port. If any of the coordinates can’t be found by the geocoding service, we want to log them via the Logger and continue the translation. 
Workspace2.png
 
Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar. 
Run.png
 
After running the workspace, in Visual Preview, there will be point features of all the schools, their addresses, and Lat/Long. 
Output2.png

 

Data Attribution

Data used in this tutorial originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.