Sorry, you need to enable JavaScript to visit this website.

Geometry Filter


This endpoint comes handy when a list of POIs is already available and needs to be filtered using a list of geometries. It will return POIs that lie within any of the geometries.

The geometry and POI lists can be sent via a POST or GET request, POST is recommended for large datasets e.g.:

GET

poiList=[{"poi":{"name":"S Restaurant Tom's"},"address":{"freeformAddress":"2880 Broadway, New York, NY 10025"},"position":{"lat":40.80558,"lon":-73.96548}},{"poi":{"name":"Yasha Raman Corporation"},"address":{"freeformAddress":"940 Amsterdam Ave, New York, NY 10025"},"position":{"lat":40.80076,"lon":-73.96556}}]
geometryList=[{"type":"CIRCLE","position":"40.80558,-73.96548","radius":100},{"type":"POLYGON","vertices":["37.7524152343544,-122.43576049804686","37.70660472542312,-122.43301391601562","37.712059855877314,-122.36434936523438","37.75350561243041,-122.37396240234374"]}]

POST

{
  "poiList": [
    {
        "poi":{
            "name":"S Restaurant Tom's"
        },
        "address":{
            "freeformAddress":"2880 Broadway, New York, NY 10025"
        },
        "position":{
            "lat":40.80558,
            "lon":-73.96548
        }
    },
    {
        "poi":{
            "name":"Yasha Raman Corporation"
        },
        "address":{
            "freeformAddress":"940 Amsterdam Ave, New York, NY 10025"
        },
        "position":{
            "lat":40.80076,
            "lon":-73.96556
        }
    }
  ],
  "geometryList": [
    {
        "type":"CIRCLE",
        "position":"40.80558,-73.96548",
        "radius":100
    },
    {
        "type":"POLYGON",
        "vertices":[
            "37.7524152343544,-122.43576049804686",
            "37.70660472542312,-122.43301391601562",
            "37.712059855877314,-122.36434936523438",
            "37.75350561243041,-122.37396240234374"
        ]
    }
  ]
}

Request

Format

GET https://<baseURL>/search/<versionNumber>/geometryFilter.<ext>?key=<apiKey>&geometryList=<geometryList>&poiList=<poiList>

Parameters

The table below describes the parameters that can be used in a request. Required parameters must be used or the call will fail. Optional parameters, which are highlighted with [square brackets], may be used. If there is a default value that will be assumed when an optional parameter is not used, it is shown in the table. The order of request parameters is not important.

Parameter Description Req'd? Type / Values Default value Max value
baseURL Base URL for calling the API. Yes api.tomtom.com
versionNumber Service version number. The current value is 2. Yes 2
ext Valid response formats are JSON, JSONP, JS or XML. Yes String
geometryList List of geometries to filter by, available types are POLYGON and CIRCLE. Format is as in the example above. Circle radius unit is meters. Yes JSON Object
poiList List of POIs to filter, format is as in the example above.
The only required attribute of a POI is position, everything else is optional and will be echoed back when passed in.
Yes JSON Object
key Your TomTom API Key. Yes String

Response

Format

For illustrative purposes the example below is neatly indented and includes all possible response fields. Actual responses are more compact and the fields present will vary based on the result type and the data available. See the response field documentation below for more information.

When requesting JSON output the response has the following structure:

{
    "summary": {
        "numResults": 1,
        "queryTime": 0
    },
    "results": []
}

Each element of the results array is in the format:

{
    "poi": {
        "name": "Upper Crust Pizza & Pasta"
    },
    "address": {
        "freeformAddress": "2501 Soquel Dr, Santa Cruz, CA 95065"
    },
    "position": {
        "lat": "36.98844",
        "lon": "-121.97483"
    }
}

Response fields

The tables below describe all of the fields that can appear in a response. Fields are listed by the response section they belong to and in the order that they appear in the response.

Field Description Type / Values
Response
summary Summary information about the search that was performed. Summary
results Result list, sorted in descending order by score. Result[]
Summary
numResults Number of Results in the response. Integer
queryTime Time spent on resolving the query. Integer
Result
poi Optional section. Only present if type == POI. Poi
address Structured address for the Result. Address
position Position of the Result. LatLon
Poi
name Name of the POI. String
Address
freeformAddress An address line formatted according to formatting rules of Result's country of origin or in case of countries it's full country name. String
LatLon
lat Latitude. Double
lon Longitude. Double

Response codes

Code Meaning and possible causes
200 OK: the search successfully returned zero or more results.
400 Bad Request: one or more parameters were incorrectly specified.
403 Forbidden: possible causes include:

  • Service requires SSL
  • Not authorized
  • Rate or volume limit exceeded
  • Unknown referer
405 Method Not Allowed: the HTTP method (GET, POST, etc) is not supported for this request.
404/596 Not Found: the HTTP request method (GET, POST, etc) or path is incorrect.
5xx Server Error: the service was unable to process your request. Contact support to resolve the issue.

Response headers

Header Description Value
Access-Control-Allow-Origin Ensures that clients that implement the CORS security model are able to access the response from this service. *
Content-Type Indicates the format of the response, as chosen by the client. Format: type/subtype; charset=utf-8 type/subtype is one of:

  • application/json
  • text/javascript
  • text/xml