HERE 地图的 platform.getPlacesService() API 没有返回 phone 数字
HERE Map's platform.getPlacesService() API is not returning phone number
任何人都可以建议 HERE MAP returns 中的哪个 API 地点详细信息以及 phone 号码(就像 Google 地图:places.PlacesService()/textSearch()) ?
我正在使用 HERE 地图 getPlacesService() 来搜索任何用户输入,这个 API 没有返回 phone 数字。
您可以查看 this example 以请求有关特定地点的更多详细信息。
...
var explore = new H.places.Explore(platform.getPlacesService());
explore.request(params, headers, onResult, onError);
function onResult(data) {
// Get the details of the first item (place) from the results:
data.results.items[0].follow(onFetchPlaceDetails, onError);
}
// Define a callback to process a successful response to the
// request for place details:
function onFetchPlaceDetails(data) {
placeDetails = data;
}
...
从这里,您可以访问 contacts
Object contained in the Places REST response 的 phone
数组(上面代码段中的 placeDetails
)。
请注意,由于 HERE Places JS API 是 REST API 上的一个非常薄的包装器,因此对象属性的名称与 REST API / JSON 匹配名字。
// Assumption: the platform is instantiated
var places = platform.getPlacesService()
var entryPoint = H.service.PlacesService.EntryPoint;
places.request(entryPoint.SEARCH, { 'at': '52.5044,13.3909', 'q': 'pizza'}, function(resp) {
console.log(resp);
}, function(resp) {
console.log('ERROR: '+resp);
});
NOTE : you can pass 'at' and 'q' dynamically
任何人都可以建议 HERE MAP returns 中的哪个 API 地点详细信息以及 phone 号码(就像 Google 地图:places.PlacesService()/textSearch()) ?
我正在使用 HERE 地图 getPlacesService() 来搜索任何用户输入,这个 API 没有返回 phone 数字。
您可以查看 this example 以请求有关特定地点的更多详细信息。
...
var explore = new H.places.Explore(platform.getPlacesService());
explore.request(params, headers, onResult, onError);
function onResult(data) {
// Get the details of the first item (place) from the results:
data.results.items[0].follow(onFetchPlaceDetails, onError);
}
// Define a callback to process a successful response to the
// request for place details:
function onFetchPlaceDetails(data) {
placeDetails = data;
}
...
从这里,您可以访问 contacts
Object contained in the Places REST response 的 phone
数组(上面代码段中的 placeDetails
)。
请注意,由于 HERE Places JS API 是 REST API 上的一个非常薄的包装器,因此对象属性的名称与 REST API / JSON 匹配名字。
// Assumption: the platform is instantiated
var places = platform.getPlacesService()
var entryPoint = H.service.PlacesService.EntryPoint;
places.request(entryPoint.SEARCH, { 'at': '52.5044,13.3909', 'q': 'pizza'}, function(resp) {
console.log(resp);
}, function(resp) {
console.log('ERROR: '+resp);
});
NOTE : you can pass 'at' and 'q' dynamically