Skip to content

You can use the arcgis-rest-places package to access the ArcGIS Places service.

Steps
  1. Install and reference the arcgis-rest-places and arcgis-rest-request packages.
  2. Set an access token to authenticate the request.
  3. Define parameters to pass to the service.
  4. Call the service and handle the results.

You can search for nearby places such as cafes, hospitals, or parks, by searching within a distance from a point or device location. You can also filter search results by using place categories.

Find nearby places and details

Learn how to find places within a radius and return details about them with the findPlacesNearby and getPlaceDetails methods.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

import { ApiKeyManager } from "@esri/arcgis-rest-request";
import { findPlacesNearPoint, getPlaceDetails } from "@esri/arcgis-rest-places";

const accessToken = "YOUR_ACCESS_TOKEN";
const authentication = ApiKeyManager.fromKey(accessToken);

findPlacesNearPoint({
  x: -118.2437, // Downtown Los Angeles, CA
  y: 34.0522,
  categoryIds: ["4f4528bc4b90abdf24c9de85"], // Sports and Recreation category
  radius: 750,
  authentication
}).then((response) => {
  console.log(JSON.stringify(response, null, 2));

  getPlaceDetails({
    placeId: response.results[0].placeId,
    requestedFields: ["all"],
    authentication
  }).then((response) => {
    console.log(JSON.stringify(response, null, 2));
  });

});
Go to tutorial

Place finding is the process of discovering businesses and geographic locations, also known as points of interest (POIs).

Find places in a bounding box

Learn how to find places within an extent with the findPlacesWithinExtent method.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

import { ApiKeyManager } from "@esri/arcgis-rest-request";
import { findPlacesWithinExtent } from "@esri/arcgis-rest-places";

const accessToken = "YOUR_ACCESS_TOKEN";
const authentication = ApiKeyManager.fromKey(accessToken);

findPlacesWithinExtent({
  xmin: -115.2, // Coordinates around the Las Vegas Strip
  ymin: 36.09,
  xmax: -115.1,
  ymax: 36.161,
  searchText: "Night Clubs", // Search for "Night Clubs"
  authentication,
  f: "geojson"
}).then((response) => {
  console.log(JSON.stringify(response, null, 2));
});
Go to tutorial

More resources

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.