This module provides the place search service.
Since: 4.1.0(11)
searchByText(searchByTextParams: SearchByTextParams): Promise<SearchByTextResult>
Searches for a place, such as a scenic spot, enterprise, or school, based on a user's input keyword and coordinate bounds. Coordinate bounds are optional. This API uses a promise to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| searchByTextParams | SearchByTextParams | Yes | Parameters for keyword search. |
Returns:
| Type | Description |
|---|---|
| Promise<SearchByTextResult> | Promise used to return SearchByTextResult. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 401 | Invalid input parameter. |
| 1002600001 | System internal error. |
| 1002600002 | Failed to connect to the Map Kit server. |
| 1002600003 | App authentication failed. |
| 1002600004 | The Map permission is not enabled. |
| 1002603001 | Zero result. |
Example:
let params: site.SearchByTextParams = {
query: "Piazzale Dante, 41, 55049 Viareggio, Tuscany, Italy",
location: {
latitude: 31.984410259206815,
longitude: 118.76625379397866
},
radius: 10000,
language: "en"
};
const result = await site.searchByText(params);
console.info("Succeeded in searching by text."); searchByText(context: common.Context, searchByTextParams: SearchByTextParams): Promise<SearchByTextResult>
Searches for a place, such as a scenic spot, enterprise, or school, based on a user's input keyword and coordinate bounds. Coordinate bounds are optional. The context can be passed. This API uses a promise to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| context | common.Context | Yes | Context. |
| searchByTextParams | SearchByTextParams | Yes | Parameters for keyword search. |
Returns:
| Type | Description |
|---|---|
| Promise<SearchByTextResult> | Promise used to return SearchByTextResult. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 401 | Invalid input parameter. |
| 1002600001 | System internal error. |
| 1002600002 | Failed to connect to the Map Kit server. |
| 1002600003 | App authentication failed. |
| 1002600004 | The Map permission is not enabled. |
| 1002603001 | Zero result. |
Example:
let params: site.SearchByTextParams = {
query: "Piazzale Dante, 41, 55049 Viareggio, Tuscany, Italy",
location: {
latitude: 31.984410259206815,
longitude: 118.76625379397866
},
radius: 10000,
language: "en"
};
const result = await site.searchByText(this.getUIContext().getHostContext(), params);
console.info("Succeeded in searching by text."); nearbySearch(nearbySearchParams: NearbySearchParams): Promise<NearbySearchResult>
Searches for nearby places based on the user's location. You can optimize the search result by providing keywords or specifying the type of the places to search. This API uses a promise to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| nearbySearchParams | NearbySearchParams | Yes | Parameters for nearby place search. |
Returns:
| Type | Description |
|---|---|
| Promise<NearbySearchResult> | Promise used to return NearbySearchResult. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 401 | Invalid input parameter. |
| 1002600001 | System internal error. |
| 1002600002 | Failed to connect to the Map Kit server. |
| 1002600003 | App authentication failed. |
| 1002600004 | The Map permission is not enabled. |
| 1002603001 | Zero result. |
Example:
let params: site.NearbySearchParams = {
location: {
latitude: 51.50811219132287,
longitude: -0.07594896472392065
},
poiTypes: [
"Watch_Store",
"SUBWAY",
"PRIMARY_SCHOOL",
"GENERAL_AUTO_REPAIR_SERVICE_CENTER"
]
}
// Return the nearby place search result.
const result = await site.nearbySearch(params);
console.info(`Succeeded in searching nearby. result is ${result}`); nearbySearch(context: common.Context, nearbySearchParams: NearbySearchParams): Promise<NearbySearchResult>
Searches for nearby places based on the user's location. The context can be passed. You can optimize the search result by providing keywords or specifying the type of the places to search. This API uses a promise to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| context | common.Context | Yes | Context. |
| nearbySearchParams | NearbySearchParams | Yes | Parameters for nearby place search. |
Returns:
| Type | Description |
|---|---|
| Promise<NearbySearchResult> | Promise used to return NearbySearchResult. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 401 | Invalid input parameter. |
| 1002600001 | System internal error. |
| 1002600002 | Failed to connect to the Map Kit server. |
| 1002600003 | App authentication failed. |
| 1002600004 | The Map permission is not enabled. |
| 1002603001 | Zero result. |
Example:
let params: site.NearbySearchParams = {
location: {
latitude:51.50811219132287,
longitude:-0.07594896472392065
},
poiTypes: [
"Watch_Store",
"SUBWAY",
"PRIMARY_SCHOOL",
"GENERAL_AUTO_REPAIR_SERVICE_CENTER"
]
}
// Return the nearby place search result.
const result = await site.nearbySearch(this.getUIContext().getHostContext(), params);
console.info(`Succeeded in searching nearby. result is ${result}`); queryAutoComplete(queryAutoCompleteParams: QueryAutoCompleteParams): Promise<QueryAutoCompleteResult>
Returns an autocomplete place and a list of suggested places based on the input keyword. This API uses a promise to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| queryAutoCompleteParams | QueryAutoCompleteParams | Yes | Parameters for autocomplete. |
Returns:
| Type | Description |
|---|---|
| Promise<QueryAutoCompleteResult> | Promise used to return QueryAutoCompleteResult. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 401 | Invalid input parameter. |
| 1002600001 | System internal error. |
| 1002600002 | Failed to connect to the Map Kit server. |
| 1002600003 | App authentication failed. |
| 1002600004 | The Map permission is not enabled. |
| 1002603001 | Zero result. |
Example:
let params: site.QueryAutoCompleteParams = {
query: "hotel",
location: {
latitude: 31.984410259206815,
longitude: 118.76625379397866
},
language: "en",
isChildren: true
};
const result = await site.queryAutoComplete(params);
console.info("Succeeded in querying."); queryAutoComplete(context: common.Context, queryAutoCompleteParams: QueryAutoCompleteParams): Promise<QueryAutoCompleteResult>
Returns an autocomplete place and a list of suggested places based on the input keyword. The context can be passed. This API uses a promise to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| context | common.Context | Yes | Context. |
| queryAutoCompleteParams | QueryAutoCompleteParams | Yes | Parameters for autocomplete. |
Returns:
| Type | Description |
|---|---|
| Promise<QueryAutoCompleteResult> | Promise used to return QueryAutoCompleteResult. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 401 | Invalid input parameter. |
| 1002600001 | System internal error. |
| 1002600002 | Failed to connect to the Map Kit server. |
| 1002600003 | App authentication failed. |
| 1002600004 | The Map permission is not enabled. |
| 1002603001 | Zero result. |
Example:
let params: site.QueryAutoCompleteParams = {
query: "hotel",
location: {
latitude: 31.984410259206815,
longitude: 118.76625379397866
},
language: "en",
isChildren: true
};
const result = await site.queryAutoComplete(this.getUIContext().getHostContext(), params);
console.info("Succeeded in querying."); searchById(searchByIdParams: SearchByIdParams): Promise<SearchByIdResult>
Obtains place details based on the place ID. Place details include the place name, detailed address, longitude, and latitude. This API uses a promise to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| searchByIdParams | SearchByIdParams | Yes | Parameters for place details search. |
Returns:
| Type | Description |
|---|---|
| Promise<SearchByIdResult> | Promise used to return SearchByIdResult. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 401 | Invalid input parameter. |
| 1002600001 | System internal error. |
| 1002600002 | Failed to connect to the Map Kit server. |
| 1002600003 | App authentication failed. |
| 1002600004 | The Map permission is not enabled. |
| 1002603001 | Zero result. |
Example:
let params: site.SearchByIdParams = {
siteId: "144129739873977856",
language: "en",
isChildren: true
};
const result = await site.searchById(params);
console.info("Succeeded in searching by id."); searchById(context: common.Context, searchByIdParams: SearchByIdParams): Promise<SearchByIdResult>
Obtains place details based on the place ID. The context can be passed. Place details include the place name, detailed address, longitude, and latitude. This API uses a promise to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| context | common.Context | Yes | Context. |
| searchByIdParams | SearchByIdParams | Yes | Parameters for place details search. |
Returns:
| Type | Description |
|---|---|
| Promise<SearchByIdResult> | Promise used to return SearchByIdResult. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 401 | Invalid input parameter. |
| 1002600001 | System internal error. |
| 1002600002 | Failed to connect to the Map Kit server. |
| 1002600003 | App authentication failed. |
| 1002600004 | The Map permission is not enabled. |
| 1002603001 | Zero result. |
Example:
let params: site.SearchByIdParams = {
siteId: "144129739873977856",
language: "en",
isChildren: true
};
const result = await site.searchById(this.getUIContext().getHostContext(), params);
console.info("Succeeded in searching by id."); geocode(geocodeParams: GeocodeParams): Promise<GeocodeResult>
Obtains the longitude and latitude of places based on their structured addresses. This API uses a promise to return the result.
This API obtains spatial coordinates (such as the longitude and latitude) of places based on their addresses. A maximum of 10 records can be returned.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| geocodeParams | GeocodeParams | Yes | Parameters for forward geocoding. |
Returns:
| Type | Description |
|---|---|
| Promise<GeocodeResult> | Promise used to return GeocodeResult. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 401 | Invalid input parameter. |
| 1002600001 | System internal error. |
| 1002600002 | Failed to connect to the Map Kit server. |
| 1002600003 | App authentication failed. |
| 1002600004 | The Map permission is not enabled. |
| 1002603001 | Zero result. |
Example:
let params: site.GeocodeParams = {
"query": "Piazzale Dante, 41, 55049 Viareggio",
"language": "en"
};
const result = await site.geocode(params);
console.info("Succeeded in geocoding."); geocode(context: common.Context, geocodeParams: GeocodeParams): Promise<GeocodeResult>
Obtains the longitude and latitude of places based on their structured addresses. The context can be passed. This API uses a promise to return the result.
This API obtains spatial coordinates (such as the longitude and latitude) of places based on their addresses. A maximum of 10 records can be returned.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| context | common.Context | Yes | Context. |
| geocodeParams | GeocodeParams | Yes | Parameters for forward geocoding. |
Returns:
| Type | Description |
|---|---|
| Promise<GeocodeResult> | Promise used to return GeocodeResult. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 401 | Invalid input parameter. |
| 1002600001 | System internal error. |
| 1002600002 | Failed to connect to the Map Kit server. |
| 1002600003 | App authentication failed. |
| 1002600004 | The Map permission is not enabled. |
| 1002603001 | Zero result. |
Example:
let params: site.GeocodeParams = {
"query": "Piazzale Dante, 41, 55049 Viareggio",
"language": "en"
};
const result = await site.geocode(this.getUIContext().getHostContext(), params);
console.info("Succeeded in geocoding."); reverseGeocode(reverseGeocodeParams: ReverseGeocodeParams): Promise<ReverseGeocodeResult>
Obtains address information based on the longitude and latitude, including the location description, structured administrative division information, and nearby POIs. This API uses a promise to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| reverseGeocodeParams | ReverseGeocodeParams | Yes | Parameters for reverse geocoding. |
Returns:
| Type | Description |
|---|---|
| Promise<ReverseGeocodeResult> | Promise used to return ReverseGeocodeResult. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 401 | Invalid input parameter. |
| 1002600001 | System internal error. |
| 1002600002 | Failed to connect to the Map Kit server. |
| 1002600003 | App authentication failed. |
| 1002600004 | The Map permission is not enabled. |
| 1002603001 | Zero result. |
Example:
let params: site.ReverseGeocodeParams = {
location: {
latitude: 31.984410259206815,
longitude: 118.76625379397866
},
language: "en",
radius: 200
};
const result = await site.reverseGeocode(params);
console.info("Succeeded in reversing geocode."); reverseGeocode(context: common.Context, reverseGeocodeParams: ReverseGeocodeParams): Promise<ReverseGeocodeResult>
Obtains address information based on the longitude and latitude, including the location description, structured administrative division information, and nearby POIs. The context can be passed. This API uses a promise to return the result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
Parameters:
| Name | Type | Mandatory | Description |
|---|---|---|---|
| context | common.Context | Yes | Context. |
| reverseGeocodeParams | ReverseGeocodeParams | Yes | Parameters for reverse geocoding. |
Returns:
| Type | Description |
|---|---|
| Promise<ReverseGeocodeResult> | Promise used to return ReverseGeocodeResult. |
Error codes:
For details about the error codes, please refer to ArkTS API Error Codes.
| ID | Error Message |
|---|---|
| 401 | Invalid input parameter. |
| 1002600001 | System internal error. |
| 1002600002 | Failed to connect to the Map Kit server. |
| 1002600003 | App authentication failed. |
| 1002600004 | The Map permission is not enabled. |
| 1002603001 | Zero result. |
Example:
let params: site.ReverseGeocodeParams = {
location: {
latitude: 31.984410259206815,
longitude: 118.76625379397866
},
language: "en",
radius: 200
};
const result = await site.reverseGeocode(this.getUIContext().getHostContext(), params);
console.info("Succeeded in reversing geocode."); Defines the result sorting rule.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 5.0.0(12).
System capability: SystemCapability.Map.Core
Since: 5.0.0(12)
| Name | Value | Description |
|---|---|---|
| COMPOSITE | 0 | Comprehensive sorting. |
| DISTANCE | 1 | Sorting by distance. |
Defines parameters for keyword search.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| query | string | No | No | Search keyword, for example, Forbidden City. The length of the parameter value ranges from 1 to 512. |
| location | mapCommon.LatLng | No | Yes | Longitude and latitude of the search result. |
| radius | number | No | Yes | Location search radius, in meters. The value ranges from 1 to 50000. The default value is 50000. The digits after the decimal point are ignored. Error code 401 will be returned for any invalid value. |
| poiTypes | Array<string> | No | Yes | Huawei POI type of a place to search. For details, please refer to HwLocationType. |
| countryCodes | Array<string> | No | Yes | Country/Region code, which complies with ISO 3166-1 alpha-2. This parameter is used to specify the country/region where places are searched. A maximum of five country/region codes can be passed. |
| cityId | string | No | Yes | City ID. This parameter is used to specify the city where places are searched. The length of the parameter value ranges from 1 to 32. Note: - Chinese names of Hong Kong (China), and Macao (China), and cities in the Chinese mainland are supported. - For Hong Kong (China), Macao (China), and cities in the Chinese mainland, the value can be a city code with 3-4 digits or an administrative division code with 6 digits. For details, please refer to City Codes and Administrative Division Codes. - The value can also be a city ID with 16-18 digits. - You can obtain the city ID using the searchByText, nearbySearch, queryAutoComplete, searchById, geocode, or reverseGeocode API. |
| isCityLimit | boolean | No | Yes | Indicates whether to strictly restrict the search to a specified city. The default value is false. This parameter must be used together with the cityId parameter. If cityId is not passed, the default value false is used for this parameter. - true: restricts the search to a specified city. - false: not to restrict the search to a specified city. |
| language | string | No | Yes | Language of the returned result. The length of the parameter value ranges from 1 to 16. For details about the language values, please refer to Languages Supported by Place Search. If this parameter is not passed, the local language will be used by default. If an invalid value is passed, the default value will be used. |
| pageSize | number | No | Yes | Number of records returned on each page. The value ranges from 1 to 20. The default value is 20. |
| pageIndex | number | No | Yes | Index of the current page. The value ranges from 1 to 500. The default value is 1. Note: pageIndex * pageSize <= 500 |
| isChildren | boolean | No | Yes | Indicates whether to return information about child nodes. The default value is false. - true: yes (Full information about child nodes will be returned.) - false: no |
Defines parameters for nearby place search.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| location | mapCommon.LatLng | No | No | Current location of a user. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| radius | number | No | Yes | Radius of a circle area where places are searched, in meters. The value ranges from 1 to 50000. The default value is 1000. The digits after the decimal point are ignored. Error code 401 will be returned for any invalid value. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| query | string | No | Yes | Search keyword. The length of the parameter value ranges from 1 to 512. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| poiTypes | Array<string> | No | Yes | Huawei POI type of a place to search. For details, please refer to HwLocationType. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| language | string | No | Yes | Input language. The length of the parameter value ranges from 1 to 16. For details about the language values, please refer to Languages Supported by Place Search. If this parameter is not passed, the local language will be used by default. If an invalid value is passed, the local language will be used. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| pageSize | number | No | Yes | Number of records returned on each page. The value ranges from 1 to 20. The default value is 20. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| pageIndex | number | No | Yes | Index of the current page. The value ranges from 1 to 500. The default value is 1. Atomic service API: This API can be used in atomic services since version 4.1.0(11). Note: pageIndex * pageSize <= 500 |
| sortRule | SortRule | No | Yes | Sorting rule. The default value is SortRule.COMPOSITE. Since: 5.0.0(12) Atomic service API: This API can be used in atomic services since version 5.0.0(12). |
Defines parameters for autocomplete.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| query | string | No | No | Search keyword. The length of the parameter value ranges from 1 to 512. |
| location | mapCommon.LatLng | No | Yes | Longitude and latitude of the search result. |
| radius | number | No | Yes | Location search radius, in meters. The value ranges from 1 to 50000. The default value is 50000. The digits after the decimal point are ignored. Error code 401 will be returned for any invalid value. |
| poiTypes | Array<string> | No | Yes | Huawei POI type of a place to search. For details, please refer to HwLocationType. |
| cityId | string | No | Yes | City ID. This parameter is used to specify the city where places are searched. The length of the parameter value ranges from 1 to 32. Note: - Chinese names of Hong Kong (China), and Macao (China), and cities in the Chinese mainland are supported. - For Hong Kong (China), Macao (China), and cities in the Chinese mainland, the value can be a city code with 3-4 digits or an administrative division code with 6 digits. For details, please refer to City Codes and Administrative Division Codes. - The value can also be a city ID with 16-18 digits. - You can obtain the city ID using the searchByText, nearbySearch, queryAutoComplete, searchById, geocode, or reverseGeocode API. |
| isCityLimit | boolean | No | Yes | Indicates whether to strictly restrict the search to a specified city. The default value is false. This parameter must be used together with the cityId parameter. If cityId is not passed, the default value false is used for this parameter. - true: restricts the search to a specified city. - false: not to restrict the search to a specified city. |
| language | string | No | Yes | Input language. The length of the parameter value ranges from 1 to 16. For details about the language values, please refer to Languages Supported by Place Search. If this parameter is not passed, the local language will be used by default. If an invalid value is passed, the default value will be used. |
| isChildren | boolean | No | Yes | Indicates whether to return information about child nodes. The default value is false. - true: yes (Full information about child nodes will be returned.) - false: no |
Defines parameters for place details search.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| siteId | string | No | No | Address ID. The length of the parameter value ranges from 1 to 256. |
| language | string | No | Yes | Input language. The length of the parameter value ranges from 1 to 16. For details about the language values, please refer to Languages Supported by Place Search. If this parameter is not passed, the local language will be used by default. If an invalid value is passed, the default value will be used. |
| isChildren | boolean | No | Yes | Indicates whether to return information about child nodes. The default value is false. - true: yes (Full information about child nodes will be returned.) - false: no |
Defines parameters for reverse geocoding.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| location | mapCommon.LatLng | No | No | Longitude and latitude. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| language | string | No | Yes | Input language. The length of the parameter value ranges from 1 to 16. For details about the language values, please refer to Languages Supported by Place Search. If this parameter is not passed, the local language will be used by default. If an invalid value is passed, the local language will be used. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| radius | number | No | Yes | Search radius, in meters. The value ranges from 0 to 1000. The default value is 1000. The digits after the decimal point are ignored. Error code 401 will be returned for any invalid value. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| isExtension | boolean | No | Yes | Indicates whether to return extended information such as POIs, AOIs, roads, and crosspoints. You are advised to set it to true. The default value is false. - true: yes - false: no. Only the division information is returned. Atomic service API: This API can be used in atomic services since version 4.1.0(11). Note: In the extended information returned, there are a maximum of 30 POIs, 10 AOIs, 3 roads, and 1 crosspoint. |
| poiTypes | Array<string> | No | Yes | Huawei POI type of a place to search. For details, please refer to HwLocationType. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| isNearbyAoi | boolean | No | Yes | Indicates whether to return nearby AOIs. This parameter is valid only when isExtension is set to true. You are advised to set this parameter to true. The default value is false. - true: returns nearby AOIs. - false: returns only AOIs specified by the passed longitude and latitude. Since: 5.0.0(12) Atomic service API: This API can be used in atomic services since version 5.0.0(12). |
| sortRule | SortRule | No | Yes | POI sorting rule. The default value is SortRule.DISTANCE, which indicates sorting by distance. Since: 5.0.0(12) Atomic service API: This API can be used in atomic services since version 5.0.0(12). |
Defines parameters for forward geocoding.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| query | string | No | No | Address information. The length of the parameter value ranges from 1 to 512. |
| language | string | No | Yes | Input language. The length of the parameter value ranges from 1 to 16. For details about the language values, please refer to Languages Supported by Place Search. If this parameter is not passed, the local language will be used by default. If an invalid value is passed, the default value will be used. |
| bounds | mapCommon.LatLngBounds | No | Yes | Coordinate bounds of the search result. |
Defines the keyword search result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| totalCount | number | No | No | Total number of records that meet the search criteria when the search is successful. |
| sites | Array<Site> | No | Yes | Search result upon a successful search. |
Defines the nearby place search result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| totalCount | number | No | No | Total number of records that meet the search criteria when the search is successful. |
| sites | Array<Site> | No | Yes | Search result upon a successful search. |
Defines the autocomplete result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| sites | Array<Site> | No | Yes | Search result upon a successful search. |
Defines the place details search result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| site | Site | No | Yes | Place details returned upon a successful search. |
Defines the reverse geocoding result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| addressComponent | AddressComponent | No | No | Address details. |
| addressDescription | string | No | No | Unstructured address text. |
| aois | Array<Aoi> | No | Yes | AOI information. |
| pois | Array<ReverseGeocodePoi> | No | Yes | POI information. |
| roads | Array<Road> | No | Yes | Road information. |
| intersections | Array<Intersection> | No | Yes | Crosspoint information. |
Defines the forward geocoding result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| sites | Array<Site> | No | Yes | Search result upon a successful search. |
Defines place details.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| siteId | string | No | No | Unique ID of a place. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| name | string | No | Yes | Place name. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| formatAddress | string | No | Yes | Formatted detailed place address. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| addressComponent | AddressComponent | No | No | Address details. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| location | mapCommon.LatLng | No | Yes | Longitude and latitude of a place. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| viewport | mapCommon.LatLngBounds | No | Yes | Viewport of a place. Note: This parameter is not supported for queryAutoComplete. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| distance | number | No | Yes | Linear distance between a place and the location specified by the input parameter location, in meters. Note: Currently, this parameter is supported only for keyword search and nearby place search. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| poi | Poi | No | Yes | POI information about a place if the place is a POI. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| utcOffset | number | No | Yes | Difference between the time zone of a place and the UTC time zone, in minutes. Note: This parameter is not supported for the autocomplete function. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| reliability | number | No | Yes | Relevance, which can be used to determine whether the search result is accurate. The value range is [0, 1]. A larger value indicates higher relevance. The value 1 indicates fully relevant. Since: 6.1.1(24) Atomic service API: This API can be used in atomic services since version 6.1.1(24). |
Address details.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| countryCode | string | No | Yes | Country/Region code. |
| countryName | string | No | Yes | Country name. |
| adminLevel1 | string | No | Yes | Level-1 administrative division. |
| adminLevel2 | string | No | Yes | Level-2 administrative division. |
| adminLevel3 | string | No | Yes | Level-3 administrative division. |
| adminLevel4 | string | No | Yes | Level-4 administrative division. |
| adminLevel5 | string | No | Yes | Level-5 administrative division. |
| locality | string | No | Yes | Locality. |
| subLocality1 | string | No | Yes | Level-1 locality. |
| subLocality2 | string | No | Yes | Level-2 locality. |
| neighborhoods | Array<string> | No | Yes | Neighborhood. |
| adminCode | string | No | Yes | Note: The administrative division codes returned by the API cover all provinces, cities, districts/counties, and towns/streets in the Chinese mainland, Hong Kong (China), and Macao (China). The document appendix includes administrative division codes of certain cities only. |
| postalCode | string | No | Yes | Postal code. |
| city | City | No | Yes | City information. |
| streetNumber | StreetNumber | No | Yes | Street number. |
Defines city information.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| cityCode | string | No | Yes | City code. |
| cityId | string | No | Yes | City ID. |
| cityName | string | No | Yes | City name. |
Defines the street number.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| direction | string | No | Yes | Direction of an input point along a street. |
| distance | number | No | Yes | Linear distance between a place and the location specified by the input parameter location, in meters. |
| location | mapCommon.LatLng | No | Yes | Longitude and latitude of a street. |
| streetNumber | string | No | Yes | Street number. |
| streetName | string | No | Yes | Street name. |
| formatAddress | string | No | Yes | Formatted street address. |
Defines POI information.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| poiTypes | Array<string> | No | Yes | Huawei POI type. For details, please refer to HwLocationType. |
| poiTypeIds | Array<string> | No | Yes | Huawei POI type ID. This parameter is reserved and is not used currently. |
| phone | string | No | Yes | Phone number. |
| internationalPhone | string | No | Yes | International phone number. |
| rating | number | No | Yes | Rating. |
| websiteUrl | string | No | Yes | Website URL. |
| openingHours | OpeningHours | No | Yes | Opening hours. |
| businessStatus | string | No | Yes | Business status. - OPEN_NOW: open - CLOSE_NOW: closed - CLOSED_TEMPORARILY: temporarily closed - CLOSED_PERMANENTLY: permanently closed - STATUS_UNKNOWN: unknown Note: This parameter is returned only by the place details search API. |
| brand | string | No | Yes | Brand name. |
| string | No | Yes | Email address. | |
| starRating | number | No | Yes | Star rating. |
| childNodes | Array<ChildNode> | No | Yes | Child node information of a POI. |
| icon | string | No | Yes | POI icon URL. |
| description | string | No | Yes | Description. |
| abstractText | string | No | Yes | Abstract information. |
| comment | Comment | No | Yes | POI comment information. |
Defines the opening hours.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| texts | Array<string> | No | Yes | Description of weekly opening hours. |
| periods | Array<Period> | No | Yes | Detailed description of opening hours. |
Defines detailed description of opening hours.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| open | TimeOfWeek | No | Yes | Opening time. |
| close | TimeOfWeek | No | Yes | Closing time. |
Defines the time model.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| week | number | No | Yes | 0: Sunday 1: Monday 2: Tuesday 3: Wednesday 4: Thursday 5: Friday 6: Saturday |
| time | string | No | Yes | 24-hour time in hhmm format. |
Defines child node information of a POI.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| siteId | string | No | Yes | Place ID. |
| name | string | No | Yes | Place name. |
| formatAddress | string | No | Yes | Formatted detailed place address. |
| location | mapCommon.LatLng | No | Yes | Longitude and latitude of a place. |
| poiTypes | Array<string> | No | Yes | Huawei POI type. For details, please refer to HwLocationType. |
Defines POI comment information.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| averageRating | number | No | Yes | Average rating. |
| total | number | No | Yes | Total number. |
Defines AOI information.
Model restriction: This API can be used only in the stage model.
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| area | number | No | Yes | AOI area, in m2. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| distance | number | No | Yes | Linear distance between a place and the location specified by the input parameter location, in meters. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| siteId | string | No | Yes | AOI ID. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| location | mapCommon.LatLng | No | Yes | Longitude and latitude of a place. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| name | string | No | Yes | Place name. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| poiType | string | No | Yes | Huawei POI type. For details, please refer to HwLocationType. Atomic service API: This API can be used in atomic services since version 4.1.0(11). |
| direction | string | No | Yes | Direction of the AOI at the input point. Since: 5.0.0(12) Atomic service API: This API can be used in atomic services since version 5.0.0(12). |
Defines the POI information in the reverse geocoding result.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| address | string | No | Yes | Address. |
| direction | string | No | Yes | Direction of an input point towards the POI. |
| distance | number | No | Yes | Linear distance between a place and the location specified by the input parameter location, in meters. |
| siteId | string | No | Yes | Place ID. |
| location | mapCommon.LatLng | No | Yes | Longitude and latitude of a place. |
| name | string | No | Yes | Place name. |
| poiType | string | No | Yes | Huawei POI type. For details, please refer to HwLocationType. |
Defines road information.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| direction | string | No | Yes | Direction of an input point along a road. |
| distance | number | No | Yes | Linear distance between a road and the location specified by the input parameter location, in meters. |
| siteId | string | No | Yes | Road ID. |
| location | mapCommon.LatLng | No | Yes | Longitude and latitude of a road. |
| name | string | No | Yes | Road name. |
Defines crosspoint information.
Model restriction: This API can be used only in the stage model.
Atomic service API: This API can be used in atomic services since version 4.1.0(11).
System capability: SystemCapability.Map.Core
Since: 4.1.0(11)
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| direction | string | No | Yes | Position relationship between the input point and the crosspoint. |
| distance | number | No | Yes | Linear distance between a crosspoint and the location specified by the input parameter location, in meters. |
| siteId | string | No | Yes | Crosspoint ID. |
| location | mapCommon.LatLng | No | Yes | Longitude and latitude of a crosspoint. |
| name | string | No | Yes | Crosspoint name. |