places

AMD: require(["esri/rest/places"], (places) => { /* code goes here */ });
ESM: import * as places from "@arcgis/core/rest/places.js";
Object: esri/rest/places
Since: ArcGIS Maps SDK for JavaScript 4.27

Find places within a search distance of a geographic point or within an extent, or find more information about specific places. Places, also known as points of interest (POIs), are businesses and geographic locations that one can discover around the world. Places also contain attributes such as name, category, street address, contact information, and more.

With the places service one can build powerful applications to help people discover, locate, and learn more about places around them. The places service can search for businesses, points of interest (POI), and popular geographic features near a location or within a bounding box. This service is currently only available if you have an ArcGIS Location Platform account.

To start, one should identify one or more place categories for the types of places of interest. Categories are used to help filter search results so only the places of interest are returned. All categories have a name and a unique ID. To help find the appropriate category and ID, one can use the places category finder tool.

Once categories have been chosen, use the queryPlacesNearPoint() or queryPlacesWithinExtent() method. To filter and return the best results, provide a list of categories and/or keywords when you search. When places are returned, they contain attributes such as name, placeId, location, and categories.

Method Overview

Name Return Type Summary Object
Promise<Object>

Get place details, including name, address, description, and other attributes.

places

A nearby search that finds places within a given radius of a location.

places

A search that finds places within a given extent.

places

Method Details

fetchPlace

Method
fetchPlace(params, requestOptions){Promise<Object>}

Get place details, including name, address, description, and other attributes.

Parameters

Defines the parameters of the place details request.

requestOptions Object
optional

Additional options to be used for the data request.

Returns
Type Description
Promise<Object> Returns a promise that resolves to an object with the results.
Example
require([
 "esri/rest/places",
 "esri/rest/support/FetchPlaceParameters"
], function(places, FetchPlaceParameters) {
   const swedishFetchPlaceParameters = new FetchPlaceParameters({
     apiKey: "YOUR_API_KEY",
     placeId: "571624acd79b8a99897357a25b744a20",  // really good plumber
     requestedFields: ["address", "description", "hours", "socialMedia"]
   });

   function fetchPlaceDetails() {
     places.fetchPlace(swedishFetchPlaceParameters).then(showPlaceDetails);
   }

   function showPlaceDetails(fetchResult) {
     console.log("Fetch place result: ", fetchResult);
   }

   fetchPlaceDetails();
});

queryPlacesNearPoint

Method
queryPlacesNearPoint(params, requestOptions){Promise<PlacesQueryResult>}

A nearby search that finds places within a given radius of a location. The location typically represents a point on a map or the geolocation of a device.

Parameters

Defines the parameters of the query request.

requestOptions Object
optional

Additional options to be used for the data request.

Returns
Type Description
Promise<PlacesQueryResult> Resolves to an object containing the PlacesQueryResult as a promise.
Example
require([
 "esri/rest/places",
 "esri/rest/support/PlacesQueryParameters"
], function(places, PlacesQueryParameters) {
   const point = {
     type: "point", // autocasts as new Point()
     longitude: 17.81840,
     latitude: 59.42145
   };

   const swedishPlacesQueryParameters = new PlacesQueryParameters({
     apiKey: "YOUR_API_KEY",
     categoryIds: ["11077"], // Bathroom Contractor
     radius: 10000,  // set radius to 10,000 meters
     point
   });

   function findPlaces() {
     places.queryPlacesNearPoint(swedishPlacesQueryParameters).then(showPlaces);
   }

   function showPlaces(placesSolveResult) {
     // results from the queryPlacesNearPoint() method
     console.log("PlacesQueryResult: ", placesSolveResult);
     // first PlaceResult object from PlacesQueryResult.results
     console.log("PlaceResult: ", placesSolveResult.results[0]);
   }

   findPlaces();
});

queryPlacesWithinExtent

Method
queryPlacesWithinExtent(params, requestOptions){Promise<PlacesQueryResult>}

A search that finds places within a given extent. An extent typically represents the visible area of a map.

Parameters

Defines the parameters of the query request.

requestOptions Object
optional

Additional options to be used for the data request.

Returns
Type Description
Promise<PlacesQueryResult> Resolves to an object containing the PlacesQueryResult as a promise.
Example
require([
 "esri/rest/places",
 "esri/rest/support/PlacesQueryParameters",
 "esri/geometry/Extent",
 "esri/geometry/SpatialReference"
], function(places, PlacesQueryParameters, Extent, SpatialReference) {
   const extent = new Extent({
     xmin: 17.75,
     ymin: 59.55,
     xmax: 18,
     ymax: 59.7,
     spatialReference: SpatialReference.WGS84
   });

   const swedishPlacesQueryParameters = new PlacesQueryParameters({
     apiKey: "YOUR_API_KEY",
     categoryIds: ["16000"], // Landmarks and Outdoors
     extent
   });

   function findPlaces() {
     places.queryPlacesWithinExtent(swedishPlacesQueryParameters).then(showPlaces);
   }

   function showPlaces(placesSolveResult) {
     // results from the queryPlacesWithinExtent() method
     console.log("PlacesQueryResult: ", placesSolveResult);
     // first PlaceResult object from PlacesQueryResult.results
     console.log("PlaceResult: ", placesSolveResult.results[0]);
   }

   findPlaces();
});

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