Reading a Geocoding Response
The Geocoder API China - BETA has the following basic response structure.
- A
MetaInfo
object that lists meta information about the request, such as theRequestId
,Timestamp
, and other additional data - A
View
object that groups search results, where theViewId
acts as a key to distinguish between different types of views - One or more
Result
objects containing the resulting items found along with attributes that determine the quality of the search result, such as:Relevance
– a value from 0 to 1 representing the percentage of the input that matched the returned address. "1" means that all input tokens were matched.Distance
– the distance, in meters, between the identified location object and the specified client positionDirection
– the direction of the location object as seen from the specified client position measured clockwise in degrees starting with 0 at true northMatchLevel
– the most detailed address field that matches the geocoding or reverse geocoding queryMatchQuality
– attribute level information about the match quality; always 1.0 for reverse geocode resultsMatchType
– quality of the location match, eitherpointAddress
orinterpolated
Location
– the location that was found, with theLocationId
,LocationType
,Address
and so on
Example response structure:
{
"Response": {
"MetaInfo": {
"Timestamp": "2018-11-30T10:52:23.138+0000"
},
"View": [
{
"_type": "SearchResultsViewType",
"ViewId": 0,
"Result": [
{
"Relevance": 0.81,
"MatchLevel": "street",
"MatchQuality": {
"Country": 1,
"City": 1,
"Street": [
0.68
]
},
"Location": {
"LocationId": "NT_LocGSLxJNTd5k6dMN4ncOB",
"LocationType": "address",
"DisplayPosition": {
"Latitude": 39.89426,
"Longitude": 116.40095
},
"NavigationPosition": [
{
"Latitude": 39.89426,
"Longitude": 116.40095
}
],
"MapView": {
"TopLeft": {
"Latitude": 39.9002,
"Longitude": 116.39973
},
"BottomRight": {
"Latitude": 39.89205,
"Longitude": 116.40113
}
},
"Address": {
"Label": "中国北京市东城区前门东路",
"Country": "CHN",
"State": "北京市",
"City": "北京市",
"District": "东城区",
"Street": "前门东路",
"AdditionalData": [
{
"value": "中国",
"key": "CountryName"
},
{
"value": "北京市",
"key": "StateName"
}
]
}
...
}