This scenario shows you how to create a dataflow to use Geocoder Geo Spatial Search feature to find the closest textual location address from the given latitude and longitude.
1. Assume you have input latitude/longitude data in “geo_search_input.txt”.
Create a new Project, Batch Job, and Dataflow
1. Create a Project:
- From the Project menu, select New > Project.
- In the Project Name field, enter Geo_Training_2.
- Click Create.
2. Create a Batch Job:
- Right-click the Geo_Training_2 project you just created and select New Batch Job.
- Type Geo_Spatial_Search and press Enter.
3. Create the Dataflow
- Make sure the Geo_Spatial_Search – job tab is highlighted.
- Select the Data Flow icon on the right sidebar and click in the canvas (design area).
- Name the dataflow geo_search.
Create a New Input File
1. Choose the Formats tab.
2. Right-click Flat Files and select New.
3. In the File Format Editor window, make the changes below. If a warning dialog pops up to overwrite the current schema, click Yes.
- Name: geo_p_search
- Root Directory: D:\DKT_Files\Geocoder (or you can click the icon beside it to select).
- File Name: geo_search_input.txt (or you can click the icon besides it to select).
- Column: | (click Shift+\ to enter character “|”)
- Skip row header: Yes
Note: If you see the file content display at the right part of the dialog, it indicates you made the right changes.
4. Change the attributes for the fields listed on the right side:
- Data Type: varchar
- Field Size: 20
5. Click Save and Close to go back to the Data Services main window.
6. Add the input file to the dataflow as source.
- In the Local Object Library, select the geo_p_search dataflow.
- Drag it to the “Data Flow” canvas
- Select Make Source.
Note: you can click the Display Data icon to view the input data.
Add the ReverseGeocode Transform
- Choose the Transform tab.
- Expand the Data Quality node.
- Select ReverseGeocode and drag it to the dataflow canvas.
- Rename it Geo_Search.
5. Link the geo_search_input to Geo_Search.
1. Configure the Input:
- Double-click the Geo_Search transform to open the Options Setup window.
- Select the Best practice radio button
- From the Input Schema Column list, select Latitude and Longitude to map the input /fields.
- Select the In use radio button.
- Remove mappings for any other fields that are mapped as input.
2. Configure the Options:
- Choose the Options tab
- Set the Radius as 0,5 and leave the others unchanged. In this example, you are trying to search the closest textual location address within 0.5 radius from the given latitude and longitude.
3. Configure the Output:
- Chose the Output tab.
- Select the All radio button.
- Select the fields shown in the screen capture below.
- Select the In Use radio button to double-check your selections.
Create a Temp Table to Contain the Output Result
1. Choose the Geo_Spatial_Search job tab.
2. Click the Template Table icon on the right side bar, and click it again on the canvas (design area).
3. In the Table name field, enter Geo_P_Search_Output.
4. From the In datastore list, elect Data_DS.
5. Click OK.
6. Link Geo_Search to Geo_P_Search_Output.
Execute the Job
- Right-click on the Geo_Spatial_Search job and select Execute.
- In the popup dialog, keep the default value and click OK.
Check the Result
1. Select the Geo_Search dataflow.
2. Click the Show Data icon on the GEO_P_SEARCH_OUTPUT to see the results.
Note: The result you see above lists the closest address associated with the latitude/longitude in the input sample file.
Remarks: Depending on the granularity of the geo address directories, Geocoder will return either a single point of a physical location or a small street line segment as the closest address.
- PRI – Assigned the given lat/long to Primary Range Interpolated (PRI) level; the return value is a small street segment with street ranges
- PRE – Assigned the given lat/long to Primary Range Exact level (PRE) level; the return value is a single household number. You must purchase the Parcel Level Geocoding directories in order to get down to this level. Currently, the parcel geo directories are only available for US in the NAVTEQ dataset.