Geocoder API
The Geocoder API is a web service within the 3taps Network that allows other programs (both external systems and other parts of the 3taps Network) to calculate the location to use for a posting based on location-specific details within the posting such as a street address or a latitude and longitude value. This process of calculating the location for a posting is known as geocoding.
-
geocode
POST /geocoder/geocode
Calculate the location for a postingParams
data ARRAY An array of postings to geocode. Each entry in this array should be a JSON object containing one or more of the following: latitude FLOAT The GPS latitude value as a decimal degree. longitude FLOAT The GPS longitude value as a decimal degree. country STRING The name of the country. state STRING The name or code of the state or region. city STRING The name of the city. locality STRING The name of a suburb, area or town within the specified city. street STRING The full street address for this location. postal STRING A zip or postal code. text STRING An unstructured location or address value. Returns
ARRAY An array with one entry for each posting. Each array entry will itself be an array with three entries: (locationCode, latitude, longitude) where locationCode is the three-character location code to use for this posting, and latitude and longitude represent the calculated GPS coordinate for this posting’s location, in the form of floating-point numbers representing decimal degrees. If the posting could not be geocoded at all, locationCode will be set to a null value. If the geocoder was unable to calculate a lat/long value for the posting based on the supplied location details, latitude and longitude will be set to null values. Example Response
[["SFO",37.77493,-122.41942],["LAX",34.05223,-118.24368]]
Sample Code
back to topvar textLocation = prompt('Enter a location to geocode', 'San Francisco, California'); var textLocation2 = prompt('Enter another location to geocode', 'Los Angeles, California'); var data = [ {text: textLocation}, {text: textLocation2} ]; threeTapsGeocoderClient.geocode(JSON.stringify(data), callback);