Compartir a través de


GeocodeRequestOptions Object

Note

Bing Maps Web Control SDK retirement

Bing Maps Web Control SDK is deprecated and will be retired. Free (Basic) account customers can continue to use Bing Maps Web Control SDK until June 30th, 2025. Enterprise account customers can continue to use Bing Maps Web Control SDK until June 30th, 2028. To avoid service disruptions, all implementations using Bing Maps Web Control SDK will need to be updated to use Azure Maps Web SDK by the retirement date that applies to your Bing Maps for Enterprise account type. For detailed migration guidance, see Migrate from Bing Maps Web Control SDK and Migrate Bing Maps Enterprise applications to Azure Maps with GitHub Copilot.

Azure Maps is Microsoft's next-generation maps and geospatial services for developers. Azure Maps has many of the same features as Bing Maps for Enterprise, and more. To get started with Azure Maps, create a free Azure subscription and an Azure Maps account. For more information about azure Maps, see Azure Maps Documentation. For migration guidance, see Bing Maps Migration Overview.

In order to geocode a location, you need to pass an object containing geocode request options into the geocode method. The following is a list of properties that can be included in a geocode request.

Name Type Description
bounds LocationRect A location rectangle that defines a boundary that is used to influence the weight of the search results. This will often change the order of results such that more relevant results to users of the specified area appear higher in the results. By default the current bounds of the map view is used by the SearchManager.
callback function(result: GeocodeResult, userData: any) A reference to a function to call when a successful result is returned from the geocode request.
count number The maximum number of results to return. The maximum number that can be returned is 20.
errorCallback function (request: GeocodeRequestOptions) A reference to a function to call when the request is returned with an error. The error callback function will receive an object containing the geocode request options used in the request.
includeCountryIso2 boolean Specifies to include the two-letter ISO country code.
includeNeighborhood boolean A boolean that specifies that neighborhood information should be included when available.

Note: This feature isn’t available in all locations.
timeout number A number indicating how long to wait, in seconds, for the geocode request to return. The default value is 5 seconds.
userData any An object containing any data that needs to be passed to the callback when the request is completed.
where string Required. A string containing the address or place to be matched to a location on the map. Required.