共用方式為


MapLocationOptions Class

Note

Bing Maps SDK for Android and iOS retirement

Bing Maps SDK for Android and iOS is deprecated and will be retired. Free (Basic) account customers can continue to use Bing Maps SDK for Android and iOS until June 30th, 2025. Enterprise account customers can continue to use Bing Maps SDK for Android and iOS until June 30th, 2028. To avoid service disruptions, all implementations using Bing Maps SDK for Android and iOS 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.

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.

Forms optional parameters for a geocoding request.

Constructors

Constructor takes no arguments, initializing all fields by default to empty optional value (parameter will not be included in the request), except for:

  • IncludeNeighborhood to true
  • IncludeCountryCode to true

Android

MapLocationOptions()

iOS

- (instancetype)init

Methods

SetReferenceIpAddress

When you specify this parameter, the location associated with the IP address is taken into account in computing the results of a location query.
The default address is the IPv4 address of the request.

Android

MapLocationOptions setReferenceIpAddress(String value)

iOS

- (void)setReferenceIpAddress:(NSString*)referenceIpAddress

SetCulture

Use the culture parameter to specify a culture for your request. The culture parameter provides the following strings in the language of the culture for:

  • Geographic entities and place names returned by the Bing Maps REST Services
  • Map labels on map images
  • Route instructions

If not specified, devices's system locale language is used by default.

Android

MapLocationOptions setCulture(String value)

iOS

- (void)setCulture:(NSString*)culture

SetRegion

A string that represents an ISO 3166-1 Alpha-2 region/country code.
This will alter Geopolitical disputed borders and labels to align with the specified user region.

If not specified, device's system locale region is used by default.

Android

MapLocationOptions setRegion(String value)

iOS

- (void)setRegion:(NSString*)region

SetIncludeNeighborhood

Specifies to include the neighborhood with the address information in the response when it is available.

Android

MapLocationOptions setIncludeNeighborhood(boolean value)

iOS

- (void)setIncludeNeighborhood:(BOOL)includeNeighborhood

SetIncludeCountryCode

Specifies to include the two-letter ISO country code.

Android

MapLocationOptions setIncludeCountryCode(boolean value)

iOS

- (void)setIncludeCountryCode:(BOOL)includeCountryCode

SetMaxResults

Specifies the maximum number of locations to return in the response.
Must be an integer between 1 and 20. The default value is 5.

Android

MapLocationOptions setMaxResults(int value)

iOS

- (void)setMaxResults:(NSUInteger)maxResults

SetIncludeEntityTypes

Only available for geocoding by location.

Specifies the entity types that you want to return in the response. Only the types you specify will be returned. If the point cannot be mapped to the entity types you specify, no location information is returned in the response.

These entity types are ordered from the most specific entity to the least specific entity. When entities of more than one entity type are found, only the most specific entity is returned. For example, if you specify Address and AdminDistrict as entity types and entities were found for both types, only the Address entity information is returned in the response. One exception to this rule is when both PopulatedPlace and Neighborhood entity types are specified and information is found for both. In this case, the information for both entity types is returned. Also, more than one Neighborhood may be returned because the area covered by two different neighborhoods can overlap.

Android

MapLocationOptions setIncludeEntityTypes(int value)

iOS

- (void)setIncludeEntityTypes:(MSMapLocationEntityTypes)IncludeEntityTypes

See Also