Geometry Filter
Purpose
The Geometry Filter endpoint becomes 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. For example:
1[2 {3 "poi": {4 "name": "S Restaurant Toms"5 },6 "address": {7 "freeformAddress": "2880 Broadway, New York, NY 10025"8 },9 "position": {10 "lat": 40.80558,11 "lon": -73.9654812 }13 },14 {15 "poi": {16 "name": "Yasha Raman Corporation"17 },18 "address": {19 "freeformAddress": "940 Amsterdam Ave, New York, NY 10025"20 },21 "position": {22 "lat": 40.80076,23 "lon": -73.9655624 }25 }26]
1[2 {3 "type": "CIRCLE",4 "position": "40.80558, -73.96548",5 "radius": 1006 },7 {8 "type": "POLYGON",9 "vertices": [10 "37.7524152343544, -122.43576049804686",11 "37.70660472542312, -122.43301391601562",12 "37.712059855877314, -122.36434936523438",13 "37.75350561243041, -122.37396240234374"14 ]15 }16]
1{2 "poiList": [3 {4 "poi": {5 "name": "S Restaurant Tom's"6 },7 "address": {8 "freeformAddress": "2880 Broadway, New York, NY 10025"9 },10 "position": {11 "lat": 40.80558,12 "lon": -73.9654813 }14 },15 {16 "poi": {17 "name": "Yasha Raman Corporation"18 },19 "address": {20 "freeformAddress": "940 Amsterdam Ave, New York, NY 10025"21 },22 "position": {23 "lat": 40.80076,24 "lon": -73.9655625 }26 }27 ],28 "geometryList": [29 {30 "type": "CIRCLE",31 "position": "40.80558,-73.96548",32 "radius": 10033 },34 {35 "type": "POLYGON",36 "vertices": [37 "37.7524152343544,-122.43576049804686",38 "37.70660472542312,-122.43301391601562",39 "37.712059855877314,-122.36434936523438",40 "37.75350561243041,-122.37396240234374"41 ]42 }43 ]44}
Run this endpoint
You can easily run this and other endpoints. Go to the TomTom API Explorer page and follow the directions.
Request data
HTTPS Methods: GET
or POST
- Constants and parameters enclosed in curly brackets { } must be replaced with their values.
- Please see the following Request parameters section with the required and optional parameters tables for their values. The generic request format is as follows.
https://{baseURL}/search/{versionNumber}/geometryFilter.{ext}?key={Your_API_Key}&geometryList={geometryList}&poiList={poiList}
1https://api.tomtom.com/search/2/geometryFilter.json?key={Your_API_Key}&geometryList=[2 {3 "type": "CIRCLE",4 "position": "40.80558, -73.96548",5 "radius": 1006 },7 {8 "type": "POLYGON",9 "vertices": [10 "37.7524152343544, -122.43576049804686",11 "37.70660472542312, -122.43301391601562",12 "37.712059855877314, -122.36434936523438",13 "37.75350561243041, -122.37396240234374"14 ]15 }16]17&poiList=[18 {19 "poi": {20 "name": "S Restaurant Toms"21 },22 "address": {23 "freeformAddress": "2880 Broadway, New York, NY 10025"24 },25 "position": {26 "lat": 40.80558,27 "lon": -73.9654828 }29 },30 {31 "poi": {32 "name": "Yasha Raman Corporation"33 },34 "address": {35 "freeformAddress": "940 Amsterdam Ave, New York, NY 10025"36 },37 "position": {38 "lat": 40.80076,39 "lon": -73.9655640 }41 }42]
1curl 'https://api.tomtom.com/search/2/geometryFilter.json?key={Your_API_Key}&geometryList=[2 {3 "type": "CIRCLE",4 "position": "40.80558, -73.96548",5 "radius": 1006 },7 {8 "type": "POLYGON",9 "vertices": [10 "37.7524152343544, -122.43576049804686",11 "37.70660472542312, -122.43301391601562",12 "37.712059855877314, -122.36434936523438",13 "37.75350561243041, -122.37396240234374"14 ]15 }16]17&poiList=[18 {19 "poi": {20 "name": "S Restaurant Toms"21 },22 "address": {23 "freeformAddress": "2880 Broadway, New York, NY 10025"24 },25 "position": {26 "lat": 40.80558,27 "lon": -73.9654828 }29 },30 {31 "poi": {32 "name": "Yasha Raman Corporation"33 },34 "address": {35 "freeformAddress": "940 Amsterdam Ave, New York, NY 10025"36 },37 "position": {38 "lat": 40.80076,39 "lon": -73.9655640 }41 }42]'
Request parameters
The following table describes the parameters that can be used in a request.
- Required parameters must be used or the call will fail.
- Optional parameters may be used.
Note: There are no optional parameters in this endpoint.
Required parameters | Description |
---|---|
| Base URL for calling the API.
|
| The service version number. |
| A valid response format: |
| List (JSON array) of geometries to filter by. Available types are
|
| List (JSON array) of POIs to filter by.
The maximum number of POIs is 50.
The only required attribute of a POI is |
| An API Key valid for the requested service. |
Request headers
Optional headers | Description |
---|---|
Enables response compression. |
Response data
Response body
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 following response fields section for more information. When requesting JSON output the response has the following structure:
1{2 "summary": {3 "numResults": 1,4 "queryTime": 05 },6 "results": []7}
Each element of the results
array is in the following format:
1{2 "poi": {3 "name": "Upper Crust Pizza & Pasta"4 },5 "address": {6 "freeformAddress": "2501 Soquel Dr, Santa Cruz, CA 95065"7 },8 "position": {9 "lat": "36.98844",10 "lon": "-121.97483"11 }12}
Response fields
The following table describes 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.
Primary fields | |
---|---|
Field | Description |
| Summary information about the search that was performed. |
| Result list, sorted in descending order by score. |
summary object | |
Field | Description |
| Number of results in the response. |
| Time spent on resolving the query. |
results array | |
Field | Description |
| Information about the Points of Interest in the result. This is an
optional section, and is only present if type == POI. |
| Structured address for the result. |
| Position of the result: |
poi object | |
Field | Description |
| Name of the POI. |
address object | |
Field | Description |
| An address line formatted according to the formatting rules of the result's country of origin. In the case of countries, its full country name. |
LatLon | |
Field | Description |
| Latitude. min/max: -90 to +90 |
| Longitude. min/max: -180 to +180 |
Response codes
The following data table contains response codes signifying successful and failed requests to an API server.
Code | Meaning & possible causes |
---|---|
| OK : The search successfully returned zero or more results. |
| Bad Request : One or more parameters were incorrectly specified. |
| Forbidden : Possible causes include
|
| Method Not Allowed : The HTTPS request method ( |
| Not Found : The HTTPS request method ( |
| Server Error : The service was unable to process your request. Contact support to resolve the issue. |
Response headers
The following data table contains response headers sent back from an API server.
Header | Description |
---|---|
Ensures that clients implementing the CORS security model are able to
access the response from this service. | |
Indicates the format of the response, as chosen by the client. | |
If requested by the client, the Search service applies gzip compression
to the responses with the Accept-Encoding header. |