WrldPoiApi
The WrldPoiApi
is an optional service for querying POI sets created with the Places Designer. It provides a JavaScript interface to the POI API REST service. This provides similar functionality to the WrldSearchbar
but without requiring an on-screen widget.
Dependencies
- poi_api.js
For an example of how to use the WrldPoiApi
see this example.
Constructor
var poiApi = new WrldPoiApi("your_api_key_here");
poiApi.search("place", map.getCenter(), function(success, results) {
if (success) { console.log(results); }
});
Argument | Type | Description |
---|---|---|
apiKey | string | A valid API key. |
Methods
The results returned from each of the following search methods are JSON objects of the form given here in the POI API documentation.
poiApi.search(searchTerm, latLng, callback, options)
Search POIs with a free-text search term.
Argument | Type | Description |
---|---|---|
searchTerm | string | A string to search with. |
latLng | Wrld.LatLng | The central location around which to search. |
callback | function | The callback to call when the search completes. Takes a boolean success argument, and an array of JSON results. |
options | object | An object containing optional parameters, described below. |
Options
These options correspond to those listed here for the free-text search REST API.
Options | Type | Default | Description |
---|---|---|---|
radius | number | 1000.0 | Radius of the search query in metres. |
number | number | 20 | Maximum number of results to return. |
minimumScore | number | 0.0 | Minimum ‘score’ for results. The higher the number the fewer results will be matched. |
indoorId | string | ID of indoor map to filter results by. | |
floor | number | 0 | The floor number of the origin of the search, starting at 0 for the lowest floor. |
floorRange | number | 15 | Number of floors to search above and below. Set to 0 to search only the specified floor. |
poiApi.searchTags(tags, latLng, callback, options)
Search POIs by their tags.
Argument | Type | Description |
---|---|---|
tags | [string] | An array of tags, or a single tag, to search with. Supply an empty array to search all tags. |
latLng | Wrld.LatLng | The central location around which to search. |
callback | function | The callback to call when the search completes. Takes a boolean success argument, and an array of JSON results. |
options | object | An object containing optional parameters, described below. |
Options
These options correspond to those listed here for the tag search REST API.
Options | Type | Default | Description |
---|---|---|---|
radius | number | 1000.0 | Radius of the search query in metres. |
number | number | 20 | Maximum number of results to return. |
poiApi.searchIndoors(indoorId, floor, callback, options)
Search POIs specifically within an indoor map.
Argument | Type | Description |
---|---|---|
indoorId | string | ID of indoor map to filter results by. |
floor | number | The floor number of the origin of the search, starting at 0 for the lowest floor. |
callback | function | The callback to call when the search completes. Takes a boolean success argument, and an array of JSON results. |
options | object | An object containing optional parameters, described below. |
Options
These options correspond to those listed here for the indoor map constrained search REST API.
Options | Type | Default | Description |
---|---|---|---|
tags | [string] | [] | An array of tags, or a single tag, to search with. Supply an empty array to search all tags. |
number | number | 20 | Maximum number of results to return. |
floorRange | number | 15 | Number of floors to search above and below. Set to 0 to search only the specified floor. |
latLng | Wrld.LatLng | The central location around which to search, used to sort results by distance. |