代码之家  ›  专栏  ›  技术社区  ›  suman mainali

这是地图平台。getPlacesService()API未返回电话号码

  •  0
  • suman mainali  · 技术社区  · 7 年前

    谁能建议哪一个 这里地图的返回位置详细信息以及 (就像谷歌地图:places.PlacesService()/textSearch())?

    我正在使用HERE地图 搜索任何用户输入,此API不会返回电话号码。

    https://developer.here.com/apiexplorer-v2-sample-data/template-web-two-box/examples/search-for-places/index.html

    2 回复  |  直到 7 年前
        1
  •  0
  •   suman mainali    7 年前

    // 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 
        2
  •  0
  •   AndrewJC    7 年前

    你可以看到 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;
    }
    ...
    

    从这里,您可以访问 phone 的数组 contacts Object Places REST response ( placeDetails 在上面的代码段中)。

    您可以探索 Place Details Response Here