span8
span4
span8
span4
FME itself is not geocoder.亚搏在线Safe Software does not own or maintain the address and location data required for geocoding.However a number of geocoding web services exist and FME can be used to geocode data by accessing these web services.When we say geocoding in this article we mean getting latitude and longitude for known addresses.
This example shows how to geocode using FME to access the Gisgraphy service.The Gisgraphy service uses both Geonames and OpenStreetMap data sources.More information on Gisgraphy can be found here:http://www.gisgraphy.com/
Address Source Data
The attached workspace uses a Creator to create a single address record and an AttributeCreator to get the address data from published parameters.You can run this workspace using File - Prompt and Run and enter a single address and see the geocoded location.
Replace the Creator with a reader of your own address data for example an Excel file or a database table.Three attributes are required:
If your data is not structured with attributes like this,FME includes many transformers to help you map the schema.The AttributeRenamer can be used to simply change the names of attributes.Or you may have separate address number and street name attributes and you can use the StringConcatenator to combine them into a single attribute called StreetAddress.
For each record,a StringConcatenator in the workspace combines the address attributes with the base URL to the Gisgraphy service (published parameter) to build a URL for each address.This URL is sent by the HTTPFetcher transformer to the Gisgraphy service and a location will be returned.Here is an example of a URL just before it is passed to the HTTPFetcher in the attribute GeoCodingURL:
http://services.gisgraphy.com/geocoding/geocode?ad...Twin Oaks Cr Waterloo&country=CA
The HTTPFetcher will automatically replace the spaces in the URL with URL encoding.
The HTTPFetcher returns an XML document for each address record in the attribute _url_contents.Within the XML there may be more than one location returned for each address,and this workspace assumes the first one in the XML document is the best match.A more complex 亚搏在线workflow could by authored to look at all of the locations returned and validate the best match.
We use the XMLFlattener on the
Now that we have latitude (lat) and longitude (lng) attributes,we use the 2DPointReplacer to create a point at each location and the CoordinateSystemSetter to set LL85 as the coordinate system on each point.
There is a MapInfo writer in the workspace but you can replace this with any writer you wish.
© 2019 亚搏在线Safe Software Inc |法律