Searching and Geocoding Addresses using Structured Address Input
The PTV xLocate service enables you to search for and geocode addresses using complete or partial address information given by stuctured address input fields. Using the web service A web service represents a communication technology applied in computer networks. It provides an interface described in a machine-processable format, for example WSDL. APIs, it is very simple to integrate this functionality.
Benefits
Using a structured address input data for geocoding has the following benefits:
- A lot of address data sources like databases or excel or csv files already provide structured data.
- The structured a address provides additional information that may lead to a better result quality.
Prerequisites
Check if the following prerequisites are fulfilled before you start with the use case:
- Installed and licensed PTV xLocate service
- Installed PTV map data
Programming Guide
The following sample illustrates the basic steps that are necessary to geocode addresses via the web service API:
// Search for the address. xlocate.searchLocations({ "$type": "SearchByAddressRequest", "address" : { "country" : "L", "city": "Luxemburg", "street": "Rue Beaumont", "houseNumber": "19" }}, searchCompleted); // Process the results. function searchCompleted(response, exception) { if (response.results instanceof Array) { print('Geocoding succeeded and yielded ' + response.results.length + ' result(s).'); } else { print('Geocoding did not succeed.'); } }Related Topics
- The Basic Geocoding Showcase provides an extended code sample for geocoding address input and displaying results on a map. Also based on Leaflet, this showcase uses additional UI elements and implements an incremental search.