HERE Map的platform.getPlacesService()API未返回电话号码

时间:2017-10-02 22:29:05

标签: javascript here-api

有人可以建议HERE MAP的哪些 API 返回详细信息以及电话号码(就像Google地图:places.PlacesService()/ textSearch())?< / p>

我使用HERE地图 getPlacesService()搜索任何用户输入,此API未返回电话号码。

对于示例代码: https://developer.here.com/apiexplorer-v2-sample-data/template-web-two-box/examples/search-for-places/index.html

2 个答案:

答案 0 :(得分:0)

您可以查看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(上面代码段中的phone)中包含的Places REST response placeDetails数组。

请注意,由于HERE Places JS API是REST API上非常薄的包装器,因此Object属性的名称与REST API / JSON名称相匹配。

您可以浏览Place Details Response Here

答案 1 :(得分:0)

&#13;
&#13;
// 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 
&#13;
&#13;
&#13;