import { addressToLocations, addressesToLocations, locationToAddress, suggestLocations } from "@arcgis/core/rest/locator.js";const { addressToLocations, addressesToLocations, locationToAddress, suggestLocations } = await $arcgis.import("@arcgis/core/rest/locator.js");- Since
- ArcGIS Maps SDK for JavaScript 4.19
A convenience module for importing locator functions when developing with TypeScript. For example, rather than importing functions one at a time like this:
import { addressToLocations } from "@arcgis/core/rest/locator/addressToLocations.js";import { locationToAddress } from "@arcgis/core/rest/locator/locationToAddress.js";You can use this module to import them on a single line:
import { addressToLocations, locationToAddress } from "@arcgis/core/rest/locator.js";Represents a geocode service resource exposed by the ArcGIS Server REST API. It is used to generate candidates for an address. It is also used to generate batch results for a set of addresses.
Set the URL to the ArcGIS Server REST resource that represents a Locator service, for example: https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer.
- See also
Functions
| Name | Return Type | Object |
|---|---|---|
| | ||
| | ||
| | ||
| |
addressToLocations
Sends a request to the ArcGIS REST geocode resource to find candidates for a single address specified in the address parameter.
- Signature
-
addressToLocations (url: string, params: AddressToLocationsParametersProperties, requestOptions?: RequestOptions): Promise<AddressCandidate[]>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| url | URL to the ArcGIS Server REST resource that represents a locator service. | | |
| params | Specify at least the | | |
| requestOptions | Additional options to be used for the data request. | |
- Returns
- Promise<AddressCandidate[]>
When resolved, returns an array of AddressCandidates. Each element of the array is a candidate that matches the input address.
addressesToLocations
Find address candidates for multiple input addresses. This method requires an ArcGIS Server 10.1 or greater geocode service.
- Signature
-
addressesToLocations (url: string, params: AddressesToLocationsParametersProperties, requestOptions?: RequestOptions): Promise<AddressCandidate[]>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| url | URL to the ArcGIS Server REST resource that represents a locator service. | | |
| params | See specifications below. | | |
| requestOptions | Additional options to be used for the data request. | |
- Returns
- Promise<AddressCandidate[]>
When resolved, the result is an array of AddressCandidates. Each element of the array is a candidate that matches the input address.
locationToAddress
Locates an address based on a given point.
- Signature
-
locationToAddress (url: string, params: LocationToAddressParametersProperties, requestOptions?: RequestOptions): Promise<AddressCandidate>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| url | URL to the ArcGIS Server REST resource that represents a locator service. | | |
| params | Specify at least the | | |
| requestOptions | Additional options to be used for the data request. | |
- Returns
- Promise<AddressCandidate>
When resolved successfully, the result is an AddressCandidate.
suggestLocations
Get character by character auto complete suggestions.
- Signature
-
suggestLocations (url: string, params: SuggestLocationsParametersProperties, requestOptions?: RequestOptions): Promise<SuggestionCandidate[]>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| url | URL to the ArcGIS Server REST resource that represents a locator service. | | |
| params | An object that defines suggest parameters. See specifications below. | | |
| requestOptions | Additional options to be used for the data request. | |
- Returns
- Promise<SuggestionCandidate[]>
Resolves to an array of SuggestionCandidate objects.