Files
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.
Data Source
The source dataset for part 1 is a Microsoft Excel file containing school addresses for the City of Vancouver.
The source dataset for part 2 is a JSON file containing latitude and longitude locations for schools in Vancouver.
Step-by-step Instructions
Exercise 1: Forward Geocoding
In this scenario, you will be geocoding using the address attribute from an Excel file to derive X and Y coordinates in the LL84 coordinate system. This tutorial will use the OpenStreetMap geocoding service to obtain the latitude and longitude coordinates for schools in Vancouver.
1. Create a New Workspace
Open FME Workbench and create a blank workspace.
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 of this article.
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.
Double-click on the Geocoder to open the parameters. In the parameters, change the Geocoding Service to OpenStreetMap. Then ensure the Mode is set to Forward and select the ADDRESS attribute for Street Address.
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 the terms and conditions with your chosen service.
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.
Run the workspace by clicking the Run button on the top toolbar, or by selecting Run > Run Workspace from the top menu bar.
After running the workspace, in the Visual Preview, there will be point features for all the schools, including their addresses and Lat/Long.
34 addresses were rejected. These may have been rejected due to spelling or address format.
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.
1. Create a New Workspace
Open FME Workbench and create a blank workspace.
2. Add a JSON (JavaScript Object Notation) Reader
Add a JSON (JavaScript Object 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 Object Notation) as the Format, then for Dataset, browse to the SchoolCoords.json dataset, which is available for download from the Files section of this article.
As of FME 2025.2, the Coordinate System parameter is now configured within the Parameters dialog of each reader/writer format. For more information, including details about the change and affected transformers, please see Coordinate System Parameter Location Change.
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.
Double-click on the Geocoder to open the parameters. In the parameters, change the Geocoding Service to OpenStreetMap. Then change the Mode to Reverse and set the Latitude and Longitude parameters to their corresponding values.
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.
Run the workspace by clicking the Run button on the top toolbar, or by selecting Run > Run Workspace from the top menu bar.
After running the workspace, in the Visual Preview, there will be point features for all the schools, including their addresses and Lat/Long.
Data Attribution
The data used here originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.