How to build a place finding app

1. Select a category

The first step is to identify one or more for the types of places you are interested in. Categories are used to help filter search results so only the type of places you are interested in are returned. All categories have a name and a unique ID. To help find the appropriate category (and ID) you can use the /categories request.

The steps to find a category are:

  1. Reference the places service.
  2. Define a filter category.
  3. Set the access token.
1
https://places-api.arcgis.com/arcgis/rest/services/places-service/v1/categories?filter=<CATEGORY>&token=<ACCESS_TOKEN>&f=pjson

APIs

ArcGIS REST JSArcGIS REST JSArcGIS API for Python
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { ApiKeyManager } from "@esri/arcgis-rest-request";
import { getCategories,searchCategories,getCategory } from "@esri/arcgis-rest-places";

const apiKey = "YOUR_ACCESS_TOKEN";

const authentication = ApiKeyManager.fromKey(apiKey);


getCategories({
  authentication
}).then((results)=>{
  console.log(JSON.stringify(results,null,2));
});

REST API

cURLcURLHTTP
1
curl 'https://places-api.arcgis.com/arcgis/rest/services/places-service/v1/categories?token=<ACCESS_TOKEN>&f=pjson'

2. Search for places

The next step is to perform a search with /near-point or /within-extent. To filter and return the best results, you should provide a list of and/or keywords when you search. When places are returned, they contain such as name, placeId, location, and categories. You can use the place attributes to display them on a map or to get more details about each place.

You can perform the following types of place search with the JavaScript Maps SDK, scripting APIs, or open source libraries. The general steps are to:

  1. Reference the places service.
  2. Set the min and max x and y values for the radius or extent, as well as the categoryIds.
  3. Set the access token.
1
https://places-api.arcgis.com/arcgis/rest/services/places-service/v1/places/near-point?x=<LONGITUDE>&y=<LATITUDE>&radius=<METERS>&categoryIds=<IDs>&pageSize=<SIZE>&token=<ACCESS_TOKEN>&f=pjson

APIs

ArcGIS REST JSArcGIS REST JSArcGIS Maps SDK for JavaScriptArcGIS API for PythonEsri LeafletMapLibre GL JSOpenLayers
Expand
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
findPlacesNearPoint({
  x: 24.938,
  y: 60.169,
  categoryIds: ["4bf58dd8d48988d12d941735", "4bf58dd8d48988d164941735", "4bf58dd8d48988d181941735"],
  radius: 500,
  authentication,
}).then(results => {
  console.log(JSON.stringify(results.places, null, 2))
})

REST API

cURLcURLHTTP
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
26
27
28
29
30
31
32
33
34
35
36
curl 'https://places-api.arcgis.com/arcgis/rest/services/places-service/v1/places/near-point' \
-d 'x=24.938' \
-d 'y=60.169' \
-d 'radius=500' \
-d 'categoryIds=4bf58dd8d48988d12d941735,4bf58dd8d48988d164941735,4bf58dd8d48988d163941735' \
-d 'token=<ACCESS_TOKEN>' \
-d 'f=pjson'

3. Get place details

The last step is to request additional place attributes for each by using the /places/{placeId} operation.

To get place details, you need to define the following:

  1. Reference the places service.
  2. Set the returned from either a nearby or bounding box search.
  3. Set the requestedFields parameter to specify the fields you want. The request fields are grouped into Place, Address, and/or Details price groups. The number of attributes returned can vary depending on the type of place.
  4. Set the access token.
1
https://places-api.arcgis.com/arcgis/rest/services/places-service/v1/places/<placeId>?requestedFields=<place_details>&token=<ACCESS_TOKEN>&f=pjson

APIs

ArcGIS REST JSArcGIS REST JSArcGIS Maps SDK for JavaScriptArcGIS API for PythonEsri LeafletMapLibre GL JSOpenLayers
Expand
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
arcgisRest
  .getPlaceDetails({
    placeId: "bd5f5dfa788b7c5f59f3bfe2cc3d9c60",
    requestedFields: ["name", "categories"],
    authentication,
  })
  .then(results => {
    console.log(JSON.stringify(results, null, 2))
  })

REST API

cURLcURLHTTP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

curl 'https://places-api.arcgis.com/arcgis/rest/services/places-service/v1/places/bd5f5dfa788b7c5f59f3bfe2cc3d9c60' \
-d 'requestedFields=name,categories' \
-d 'f=pjson' \
-d 'token=<ACCESS_TOKEN>' \

Additional resources

Tutorials

Find nearby places and details

Find points of interest near a location and get detailed information about them.


Find places in a bounding box

Perform a text-based search to find places within a bounding box.


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

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close