require(["esri/rest/support/PlacesQueryParameters"], (PlacesQueryParameters) => { /* code goes here */ });
import PlacesQueryParameters from "@arcgis/core/rest/support/PlacesQueryParameters.js";
esri/rest/support/PlacesQueryParameters
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
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
An authorization string used to access a resource or service. | PlacesParameters | ||
Filters places to those that match the category Ids. | PlacesQueryParameters | ||
The name of the class. | Accessor | ||
The extent of the bounding box to be searched inside. | PlacesQueryParameters | ||
Determines whether icons are returned and the type of icons returned. | PlacesParameters | ||
Request results starting from the given offset. | PlacesQueryParameters | ||
The number of places that should be sent in the response for a single request. | PlacesQueryParameters | ||
A location defined by X and Y coordinates. | PlacesQueryParameters | ||
The radius in meters to search for places, measured from the supplied point. | PlacesQueryParameters | ||
Free search text for places against names, categories, etc. | PlacesQueryParameters | ||
URL to the places service. | PlacesParameters |
Property Details
-
apiKey
InheritedPropertyapiKey String
Inherited from PlacesParameters -
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
-
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
-
extent
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
Examplerequire([ "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: SpatialReference.WGS84 }); 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(); });
-
icon
InheritedPropertyicon String
Inherited from PlacesParametersSince: ArcGIS Maps SDK for JavaScript 4.30PlacesParameters since 4.27, icon added at 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
.Possible Values:"cim" |"png" |"svg"
-
offset
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
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 Point
-
A location defined by X and Y coordinates. This is required for the queryPlacesNearPoint() method.
- See also
Examplerequire([ "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
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
searchText String
-
Free search text for places against names, categories, etc. The value must be a string between 3 and 255 characters long.
-
url
InheritedPropertyurl String
Inherited from PlacesParameters -
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
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
Creates a deep clone of the instance of PlacesQueryParameters that this method is called on. | PlacesQueryParameters | ||
Returns true if a named group of handles exist. | Accessor | ||
Removes a group of handles owned by the object. | Accessor |
Method Details
-
Inherited from Accessor
-
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();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey 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.
-
clone
clone(){PlacesQueryParameters}
-
Creates a deep clone of the instance of PlacesQueryParameters that this method is called on.
ReturnsType Description PlacesQueryParameters A clone of the instance that this method is called on.
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from Accessor -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType 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"); }
-
Inherited from Accessor
-
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");