PlacesQueryParameters

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

The following properties define the parameters for the queryPlacesNearPoint() and queryPlacesWithinExtent() methods pointing to a url that represents a places service. The places service is a ready-to-use service that can search for businesses and geographic locations around the world. It allows you to discover, locate, and return detailed information about a place.

See also

Constructors

new PlacesQueryParameters(properties)
Parameter
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
String

An authorization string used to access a resource or service.

more details
PlacesParameters
String[]

Filters places to those that match the category Ids.

more details
PlacesQueryParameters
String

The name of the class.

more details
Accessor
Extent

The extent of the bounding box to be searched inside.

more details
PlacesQueryParameters
Number

Request results starting from the given offset.

more details
PlacesQueryParameters
Number

The number of places that should be sent in the response for a single request.

more details
PlacesQueryParameters
Point

A location defined by X and Y coordinates.

more details
PlacesQueryParameters
Number

The radius in meters to search for places, measured from the supplied point.

more details
PlacesQueryParameters
String

Free search text for places against names, categories, etc.

more details
PlacesQueryParameters
String

URL to the places service.

more details
PlacesParameters

Property Details

apiKey String inherited

An authorization string used to access a resource or service. API keys are generated and managed in the ArcGIS Developer dashboard. An API key is tied explicitly to an ArcGIS account; it is also used to monitor service usage. Setting a fine-grained API key on a specific class overrides the global API key.

See also
categoryIds String[]

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 search up to a maximum of 10 category Ids.

See also
declaredClass Stringreadonly inherited

The name of the class. The declared class name is formatted as esri.folder.className.

extent Extent

The extent of the bounding box to be searched inside. This is required for the queryPlacesWithinExtent() method.

The total width of the extent must be less than 20,000 meters, and the total height of the extent must be less than 20,000 meters.

See also
Example
require([
 "esri/rest/places",
 "esri/rest/support/PlacesQueryParameters",
 "esri/geometry/Extent"
], function(places, PlacesQueryParameters, Extent) {
   const extent = new Extent({
     xmin: 17.75,
     ymin: 59.55,
     xmax: 18,
     ymax: 59.7,
     spatialReference: 4326
   });

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

   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();
});
offset Number

Request results starting from the given offset.

This parameter works with the pageSize property to get results from subsequent pages. For example, with pageSize = 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.

Default Value:0
pageSize Number

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 the 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.

Default Value:10
point Point

A location defined by X and Y coordinates. This is required for the queryPlacesNearPoint() method.

See also
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,
     searchText: "Bygg",
     pageSize: 11
   });

   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();
});
radius Number

The radius in meters to search for places, measured from the supplied point. This property is only used by the queryPlacesNearPoint() method. The maximum value is 10,000.

Default Value:1000
searchText String

Free search text for places against names, categories, etc. The value must be a string between 3 and 255 characters long.

URL to the places service. The places service is a ready-to-use service that can search for businesses and geographic locations around the world. It allows you to discover, locate, and return detailed information about a place.

Default Value:"https://places-api.arcgis.com/arcgis/rest/services/places-service/v1"

Method Overview

Show inherited methods Hide inherited methods
Name Return Type Summary Class

Adds one or more handles which are to be tied to the lifecycle of the object.

more details
Accessor
PlacesQueryParameters

Creates a deep clone of the instance of PlacesQueryParameters that this method is called on.

more details
PlacesQueryParameters
Boolean

Returns true if a named group of handles exist.

more details
Accessor

Removes a group of handles owned by the object.

more details
Accessor

Method Details

addHandles(handleOrHandles, groupKey)inherited

Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.

// Manually manage handles
const handle = reactiveUtils.when(
  () => !view.updating,
  () => {
    wkidSelect.disabled = false;
  },
  { once: true }
);

this.addHandles(handle);

// Destroy the object
this.destroy();
Parameters
handleOrHandles WatchHandle|WatchHandle[]

Handles marked for removal once the object is destroyed.

groupKey *
optional

Key identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.

Creates a deep clone of the instance of PlacesQueryParameters that this method is called on.

Returns
Type Description
PlacesQueryParameters A clone of the instance that this method is called on.
hasHandles(groupKey){Boolean}inherited

Returns true if a named group of handles exist.

Parameter
groupKey *
optional

A group key.

Returns
Type Description
Boolean Returns true if a named group of handles exist.
Example
// Remove a named group of handles if they exist.
if (obj.hasHandles("watch-view-updates")) {
  obj.removeHandles("watch-view-updates");
}
removeHandles(groupKey)inherited

Removes a group of handles owned by the object.

Parameter
groupKey *
optional

A group key or an array or collection of group keys to remove.

Example
obj.removeHandles(); // removes handles from default group

obj.removeHandles("handle-group");
obj.removeHandles("other-handle-group");

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