import PlacesQueryParameters from "@arcgis/core/rest/support/PlacesQueryParameters.js";const PlacesQueryParameters = await $arcgis.import("@arcgis/core/rest/support/PlacesQueryParameters.js");- 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.
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
apiKey inherited | ||
| | ||
declaredClass readonly inherited | ||
| | ||
icon inherited | ||
| | ||
| | ||
| | ||
| | ||
| | ||
url inherited |
apiKey
An authorization string used to access a resource or service. API keys are generated and managed in the portal. 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
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
const [places, PlacesQueryParameters, Extent] = await $arcgis.import([ "@arcgis/core/rest/places.js", "@arcgis/core/rest/support/PlacesQueryParameters.js", "@arcgis/core/geometry/Extent.js");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: ["4d4b7105d754a06377d81259"], // 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(); icon
- Since
- ArcGIS Maps SDK for JavaScript 4.30
Determines whether icons are returned and the type of icons returned.
The PNG icons are provided as 48 x 48 pixels but for map display the recommended size is 16 x 16 pixels.
Icons are not returned if the value is null.
offset
- Type
- 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
- Type
- 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
A location defined by X and Y coordinates. This is required for the queryPlacesNearPoint() method.
- See also
Example
const [places, PlacesQueryParameters] = await $arcgis.import([ "@arcgis/core/rest/places.js", "@arcgis/core/rest/support/PlacesQueryParameters.js"]);const point = { type: "point", // autocasts as new Point() longitude: 17.81840, latitude: 59.42145};
const swedishPlacesQueryParameters = new PlacesQueryParameters({ apiKey: "YOUR_API_KEY", categoryIds: ["63be6904847c3692a84b9b4c"], // 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
- Type
- 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
url
- Type
- string
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"
Methods
| Method | Signature | Class |
|---|---|---|
clone(): PlacesQueryParameters | |
clone
- Signature
-
clone (): PlacesQueryParameters
Creates a deep clone of the instance of PlacesQueryParameters that this method is called on.
- Returns
- PlacesQueryParameters
A clone of the instance that this method is called on.