MapsSearchClient class

Client class for interacting with Azure Maps Search Service.

Constructors

MapsSearchClient(AzureKeyCredential, MapsSearchClientOptions)

Creates an instance of MapsSearchClient from a subscription key.

Example

import { MapsSearchClient, AzureKeyCredential } from "@azure/maps-search";

const credential = new AzureKeyCredential("<subscription-key>");
const client = new MapsSearchClient(credential);
MapsSearchClient(TokenCredential, string, MapsSearchClientOptions)

Creates an instance of MapsSearchClient from an Azure Identity TokenCredential.

Example

import { MapsSearchClient } from "@azure/maps-search";
import { DefaultAzureCredential } from "@azure/identity";

const credential = new DefaultAzureCredential();
const client = new MapsSearchClient(credential, "<maps-account-client-id>");

Methods

beginFuzzySearchBatch(FuzzySearchRequest[], FuzzySearchBatchOptions)

Sends batches of fuzzy search requests. The method returns a poller for retrieving the result later.

beginReverseSearchAddressBatch(ReverseSearchAddressRequest[], ReverseSearchAddressBatchOptions)

Sends batches of reverse geocoding requests. The method returns a poller for retrieving the result later.

beginSearchAddressBatch(SearchAddressRequest[], SearchAddressBatchOptions)

Sends batches of geocoding requests. The method returns a poller for retrieving the result later.

fuzzySearch(SearchQuery, FuzzySearchBaseOptions & OperationOptions)

Performs a free-form Search which handles the most fuzzy of inputs handling any combination of address or POI tokens.

getGeometries(string[], OperationOptions)

Requests the geometry data such as a city or country outline for a set of entities.

getPointOfInterestCategories(GetPointOfInterestCategoriesOptions)

Requests a full list of supported Points of Interest (POI) categories.

resumeFuzzySearchBatch(string, FuzzySearchBatchOptions)

Continue the fuzzy search request with a serialized state from other poller.

Example

const serializedState = poller.toString()
const rehydratedPoller = resumeFuzzySearchBatch(serializedState)
rehydratedPoller.poll()
resumeReverseSearchAddressBatch(string, ReverseSearchAddressBatchOptions)

Continue the reverse address search request with a serialized state from other poller.

Example

const serializedState = poller.toString()
const rehydratedPoller = resumeReverseSearchAddressBatch(serializedState)
rehydratedPoller.poll()
resumeSearchAddressBatch(string, SearchAddressBatchOptions)

Continue the address search request with a serialized state from other poller.

Example

const serializedState = poller.toString()
const rehydratedPoller = resumeSearchAddressBatch(serializedState)
rehydratedPoller.poll()
reverseSearchAddress(LatLon, ReverseSearchAddressOptions & OperationOptions)

Translates a coordinates into a human understandable street address.

reverseSearchCrossStreetAddress(LatLon, ReverseSearchCrossStreetAddressOptions)

Translates a coordinates into a human understandable cross street.

searchAddress(string, SearchAddressOptions & OperationOptions)

Geocodes a address.

searchAlongRoute(string, number, GeoJsonLineString, SearchAlongRouteOptions)

Performs a fuzzy search for POIs along a specified route.

searchInsideGeometry(string, SearchGeometry, SearchInsideGeometryOptions)

Performs a free form search inside a single geometry or many of them.

searchNearbyPointOfInterest(LatLon, SearchNearbyPointOfInterestOptions)

Requests points of interest (POI) results around a specific location.

searchPointOfInterest(SearchQuery, SearchPointOfInterestOptions)

Requests points of interest (POI) results by name

searchPointOfInterestCategory(SearchQuery, SearchPointOfInterestOptions)

Requests points of interests (POI) results from given category.

searchStructuredAddress(StructuredAddress, SearchStructuredAddressOptions)

Geocodes a structured address.

Constructor Details

MapsSearchClient(AzureKeyCredential, MapsSearchClientOptions)

Creates an instance of MapsSearchClient from a subscription key.

Example

import { MapsSearchClient, AzureKeyCredential } from "@azure/maps-search";

const credential = new AzureKeyCredential("<subscription-key>");
const client = new MapsSearchClient(credential);
new MapsSearchClient(credential: AzureKeyCredential, options?: MapsSearchClientOptions)

Parameters

credential
AzureKeyCredential

An AzureKeyCredential instance used to authenticate requests to the service

options
MapsSearchClientOptions

Options used to configure the Search Client

MapsSearchClient(TokenCredential, string, MapsSearchClientOptions)

Creates an instance of MapsSearchClient from an Azure Identity TokenCredential.

Example

import { MapsSearchClient } from "@azure/maps-search";
import { DefaultAzureCredential } from "@azure/identity";

const credential = new DefaultAzureCredential();
const client = new MapsSearchClient(credential, "<maps-account-client-id>");
new MapsSearchClient(credential: TokenCredential, mapsAccountClientId: string, options?: MapsSearchClientOptions)

Parameters

credential
TokenCredential

An TokenCredential instance used to authenticate requests to the service

mapsAccountClientId

string

The Azure Maps client id of a specific map resource

options
MapsSearchClientOptions

Options used to configure the Search Client

Method Details

beginFuzzySearchBatch(FuzzySearchRequest[], FuzzySearchBatchOptions)

Sends batches of fuzzy search requests. The method returns a poller for retrieving the result later.

function beginFuzzySearchBatch(requests: FuzzySearchRequest[], options?: FuzzySearchBatchOptions): Promise<FuzzySearchBatchPoller>

Parameters

requests

FuzzySearchRequest[]

The array of search requests to process. The array can contain a max of 10,000 requests and must contain at least 1 request.

options
FuzzySearchBatchOptions

Optional parameters for the operation

Returns

beginReverseSearchAddressBatch(ReverseSearchAddressRequest[], ReverseSearchAddressBatchOptions)

Sends batches of reverse geocoding requests. The method returns a poller for retrieving the result later.

function beginReverseSearchAddressBatch(requests: ReverseSearchAddressRequest[], options?: ReverseSearchAddressBatchOptions): Promise<ReverseSearchAddressBatchPoller>

Parameters

requests

ReverseSearchAddressRequest[]

The array of search requests to process. The array can contain a max of 10,000 requests and must contain at least 1 request.

options
ReverseSearchAddressBatchOptions

Optional parameters for the operation

Returns

beginSearchAddressBatch(SearchAddressRequest[], SearchAddressBatchOptions)

Sends batches of geocoding requests. The method returns a poller for retrieving the result later.

function beginSearchAddressBatch(requests: SearchAddressRequest[], options?: SearchAddressBatchOptions): Promise<FuzzySearchBatchPoller>

Parameters

requests

SearchAddressRequest[]

The array of search requests to process. The array can contain a max of 10,000 requests and must contain at least 1 request.

options
SearchAddressBatchOptions

Optional parameters for the operation

Returns

fuzzySearch(SearchQuery, FuzzySearchBaseOptions & OperationOptions)

Performs a free-form Search which handles the most fuzzy of inputs handling any combination of address or POI tokens.

function fuzzySearch(searchQuery: SearchQuery, options?: FuzzySearchBaseOptions & OperationOptions): Promise<SearchAddressResult>

Parameters

searchQuery
SearchQuery

Text query and location information to search

options

FuzzySearchBaseOptions & OperationOptions

Options for fuzzy search

Returns

getGeometries(string[], OperationOptions)

Requests the geometry data such as a city or country outline for a set of entities.

function getGeometries(geometryIds: string[], options?: OperationOptions): Promise<EntityGeometry[]>

Parameters

geometryIds

string[]

Comma separated list of geometry UUIDs, previously retrieved from an Online Search request.

options
OperationOptions

Optional parameters for the operation

Returns

Promise<EntityGeometry[]>

getPointOfInterestCategories(GetPointOfInterestCategoriesOptions)

Requests a full list of supported Points of Interest (POI) categories.

function getPointOfInterestCategories(options?: GetPointOfInterestCategoriesOptions): Promise<PointOfInterestCategory[]>

Parameters

options
GetPointOfInterestCategoriesOptions

Optional parameters for the operation

Returns

resumeFuzzySearchBatch(string, FuzzySearchBatchOptions)

Continue the fuzzy search request with a serialized state from other poller.

Example

const serializedState = poller.toString()
const rehydratedPoller = resumeFuzzySearchBatch(serializedState)
rehydratedPoller.poll()
function resumeFuzzySearchBatch(restoreFrom: string, options?: FuzzySearchBatchOptions): Promise<FuzzySearchBatchPoller>

Parameters

restoreFrom

string

The serialized state from the previous poller.

options
FuzzySearchBatchOptions

Optional parameters for the operation.

Returns

resumeReverseSearchAddressBatch(string, ReverseSearchAddressBatchOptions)

Continue the reverse address search request with a serialized state from other poller.

Example

const serializedState = poller.toString()
const rehydratedPoller = resumeReverseSearchAddressBatch(serializedState)
rehydratedPoller.poll()
function resumeReverseSearchAddressBatch(restoreFrom: string, options?: ReverseSearchAddressBatchOptions): Promise<ReverseSearchAddressBatchPoller>

Parameters

restoreFrom

string

The serialized state from the previous poller.

options
ReverseSearchAddressBatchOptions

Optional parameters for the operation.

Returns

resumeSearchAddressBatch(string, SearchAddressBatchOptions)

Continue the address search request with a serialized state from other poller.

Example

const serializedState = poller.toString()
const rehydratedPoller = resumeSearchAddressBatch(serializedState)
rehydratedPoller.poll()
function resumeSearchAddressBatch(restoreFrom: string, options?: SearchAddressBatchOptions): Promise<FuzzySearchBatchPoller>

Parameters

restoreFrom

string

The serialized state from the previous poller.

options
SearchAddressBatchOptions

Optional parameters for the operation.

Returns

reverseSearchAddress(LatLon, ReverseSearchAddressOptions & OperationOptions)

Translates a coordinates into a human understandable street address.

function reverseSearchAddress(coordinates: LatLon, options?: ReverseSearchAddressOptions & OperationOptions): Promise<ReverseSearchAddressResult>

Parameters

coordinates
LatLon

The coordinates for the reverse search query

options

ReverseSearchAddressOptions & OperationOptions

Optional parameters for the operation

Returns

reverseSearchCrossStreetAddress(LatLon, ReverseSearchCrossStreetAddressOptions)

Translates a coordinates into a human understandable cross street.

function reverseSearchCrossStreetAddress(coordinates: LatLon, options?: ReverseSearchCrossStreetAddressOptions): Promise<ReverseSearchCrossStreetAddressResult>

Parameters

coordinates
LatLon

The coordinates for the reverse search query

options
ReverseSearchCrossStreetAddressOptions

Optional parameters for the operation

Returns

searchAddress(string, SearchAddressOptions & OperationOptions)

Geocodes a address.

function searchAddress(query: string, options?: SearchAddressOptions & OperationOptions): Promise<SearchAddressResult>

Parameters

query

string

The address to search for (e.g., "1 Microsoft way, Redmond, WA")

options

SearchAddressOptions & OperationOptions

Optional parameters for the operation

Returns

searchAlongRoute(string, number, GeoJsonLineString, SearchAlongRouteOptions)

Performs a fuzzy search for POIs along a specified route.

function searchAlongRoute(query: string, maxDetourTimeInSeconds: number, route: GeoJsonLineString, options?: SearchAlongRouteOptions): Promise<SearchAddressResult>

Parameters

query

string

The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza").

maxDetourTimeInSeconds

number

Maximum detour time of the point of interest in seconds. Max value is 3600 seconds

route
GeoJsonLineString

This represents the route to search along and should be a valid GeoJSON LineString type.

options
SearchAlongRouteOptions

Optional parameters for the operation

Returns

searchInsideGeometry(string, SearchGeometry, SearchInsideGeometryOptions)

Performs a free form search inside a single geometry or many of them.

function searchInsideGeometry(query: string, geometry: SearchGeometry, options?: SearchInsideGeometryOptions): Promise<SearchAddressResult>

Parameters

query

string

The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza").

geometry
SearchGeometry

This represents the geometry for one or more geographical features (parks, state boundary etc.) to search in and should be a GeoJSON compliant type. Please refer to RFC 7946 for details.

options
SearchInsideGeometryOptions

Optional parameters for the operation

Returns

searchNearbyPointOfInterest(LatLon, SearchNearbyPointOfInterestOptions)

Requests points of interest (POI) results around a specific location.

function searchNearbyPointOfInterest(coordinates: LatLon, options?: SearchNearbyPointOfInterestOptions): Promise<SearchAddressResult>

Parameters

coordinates
LatLon

The coordinates for the nearby POI search

options
SearchNearbyPointOfInterestOptions

Optional parameters for the operation

Returns

searchPointOfInterest(SearchQuery, SearchPointOfInterestOptions)

Requests points of interest (POI) results by name

function searchPointOfInterest(searchQuery: SearchQuery, options?: SearchPointOfInterestOptions): Promise<SearchAddressResult>

Parameters

searchQuery
SearchQuery

Text query and location information to search

options
SearchPointOfInterestOptions

Options for search POI

Returns

searchPointOfInterestCategory(SearchQuery, SearchPointOfInterestOptions)

Requests points of interests (POI) results from given category.

function searchPointOfInterestCategory(searchQuery: SearchQuery, options?: SearchPointOfInterestOptions): Promise<SearchAddressResult>

Parameters

searchQuery
SearchQuery

Text query and location information to search

options
SearchPointOfInterestOptions

Options for search POI category

Returns

searchStructuredAddress(StructuredAddress, SearchStructuredAddressOptions)

Geocodes a structured address.

function searchStructuredAddress(structuredAddress: StructuredAddress, options?: SearchStructuredAddressOptions): Promise<SearchAddressResult>

Parameters

structuredAddress
StructuredAddress

Structured address used for geocoding

options
SearchStructuredAddressOptions

Optional parameters for the operation

Returns