geocode

geocode

geocode(addressstring | IGeocodeOptions): Promise<IGeocodeResponse>

Used to determine the location of a single address or point of interest. See the REST Documentation for more information.

Use dark colors for code blocksCopy
               
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { geocode } from '@esri/arcgis-rest-geocoding';

geocode("LAX")
 .then((response) => {
   response.candidates[0].location; // => { x: -118.409, y: 33.943, spatialReference: ...  }
 });

geocode({
 address: "1600 Pennsylvania Ave",
 postal: 20500,
 countryCode: "USA"
})
 .then((response) => {
   response.candidates[1].location; // => { x: -77.036533, y: 38.898719, spatialReference: ... }
 });
Parameters
ParameterTypeNotes
address
string | IGeocodeOptions

String representing the address or point of interest or RequestOptions to pass to the endpoint.

Returns 
Promise<IGeocodeResponse>

A Promise that will resolve with address candidates for the request. The spatial reference will be added to candidate locations and extents unless rawResponse: true was passed.

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