Search for places in London using a category and/or text filter
What is a bounding box search?
A bounding box search finds places within an extent. An extent typically represents the visible area of a map.
You can use this search to:
Find and display places within a current map extent.
Get the latitude and longitude for places.
Filter places using categories and/or text.
Find place attributes including placeId, name, categories, and location.
Find place IDs so you can request additional place details.
How a bounding box search works
To perform a bounding box search, you use the places service /places/within-extent request and set the xmin, ymin, xmax, and ymax coordinates. The maximum width and height of the search extent is 10,000 meters.
Filters places to those that match the category Ids.
Places will be returned if they match any of the category Ids. If this
property is not set, places will be returned regardless of their
category.
You can obtain information on category Ids from the
places/categories endpoint. For example, to filter for places
where the category is "Bicycle Store", include the categoryId
17117 in this property.
You can search up to a maximum of 10 category Ids.
The number of places that should be sent in the response for a single request.
You can set this to any value up to 20 when you need to control the
size of responses that your app downloads.
If the query results in more than this page size, then the response object
will contain a next url fragment. This fragment can be used to form a
request url to fetch the next page of results.
The maximum number of places that can be returned in total is 200. If
a request reaches this limit without returning all of the available
places, the response will contain the property
"maxResultsExceeded":true in addition to place results.
This parameter works with the pageSize parameter to fetch results from
subsequent pages. For example, with a page size of 2, setting the
offset to 2 would return the 3rd and 4th results.
Regardless of paging, the maximum number of places that can be returned
by a single query is 200. When a query results in more than 200
places, the response will contain the property
"maxResultsExceeded":true in addition to place results.
The authentication token with the premium:user:places privilege, used to access the Places service.
The token parameter can be either an API Key or short-lived token. See
ArcGIS security
documentation
for more information on authenticating with a token or API key.
Alternatively, you can supply a token in the request header with one of
the following keys using the "Bearer" scheme:
Authorization: Bearer <YOUR_TOKEN>
X-Esri-Authorization: Bearer <YOUR_TOKEN>
Code examples
Find places by category
In this example, you use specific categories to find places within a map extent for Helsinki. Moving the map will execute a search for the new extent.
The categories are:
Museum (16027)
Park (16032)
Monument (16026)
Steps
Reference the places service.
Set the min and max x and y values for the extent and the categoryIds.
Set the token parameter to your access token.
Find places in specific categories within the current map extent.
In this example, you use the categoryIds and searchText parameters to find places that are within the map extent for area in London. Moving the map will execute a search for the new extent.
The categories are:
Pub (13018)
Fish and Chips Shop (13051)
Sports Club (18065)
Steps
Reference the places service.
Define the extent for the search and set the categoryIds and searchText parameters with the keywords.
This example searches for all places without using categories for an extent near Seattle. Moving the map will execute a search for the new extent.
If there are more results than the pageSize, you can page through them using the next URL in the links attribute. The maximum number of places that you can page through is 200.
Steps
Reference the places service.
Define the extent for the search.
Set the token parameter to your access token.
Using ArcGIS REST JS, if repsponse.nextPage is valid, use the nextPage() to send the next request.
Return 200 places by paging through result response.