Search for places in New York using a category, text filter, and radius
What is a nearby search?
A nearby search finds places within a given radius of a location. The location typically represents a point on a map or the geolocation of a device.
You can use this search to:
Find and display places within a distance of a location.
Get the latitude and longitude for places.
Filter places using categories and/or text.
Find place attributes including placeId, name, categories, distance, and location.
Find place IDs so you can request additional place details.
How to perform a nearby search
To perform a nearby search, you use the places service /places/near-point request and set the x and y coordinates and the radius in meters that you would like to search. The default radius is 1,000 meters and the maximum value is 10,000 meters.
The radius in meters to search for places - measured from the supplied x and y coordinate.
A radius of 100 meters will result in a circular search area that is 200
meters in diameter. If omitted, the default search radius will be 1,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 pagination.nextUrl. This can be used to request
the next page of results.
Regardless of paging, the maximum number of places that can be returned
in total is 200.
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
in total is 200.
The authentication token with the premium:user:placesprivilege, 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 location near Helsinki within a 500 meter radius. Clicking on the map will execute a new search.
The categories are:
Museum (10027)
Park (16032)
Monument (16026)
Steps
Reference the places service.
Define the x and y coordinates, categoryIds, and radius.
Set the token parameter to your access token.
Find places in specific categories within a 500 meter search radius.
APIs
ArcGIS REST JSArcGIS REST JSArcGIS Maps SDK for JavaScriptArcGIS API for PythonEsri LeafletMapLibre GL JSOpenLayers
In this example, you use the categoryIds and searchText parameters to find places that are within 1609 meters of a location in London. Clicking on the map will execute a new search.
The categories are:
Pub (13018)
Fish and Chips Shop (13051)
Sports Club (18065)
Steps
Reference the places service.
Define the x and y coordinates, categoryIds, and the searchText parameters.
Set the token parameter to your access token.
Filter results from specific categories using a text search
APIs
ArcGIS REST JSArcGIS REST JSArcGIS Maps SDK for JavaScriptArcGIS API for PythonEsri LeafletMapLibre GL JSOpenLayers
This example searches for all places without using categories within 250m of a location in Wellington. Clicking on the map will execute a new search.
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 x and y coordinates 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.
APIs
ArcGIS REST JSArcGIS REST JSArcGIS Maps SDK for JavaScriptArcGIS API for PythonEsri LeafletMapLibre GL JSOpenLayers