小编zek*_*kai的帖子

放置API - 将地点照片作为标记图标

我按照本指南 https://developers.google.com/maps/documentation/javascript/places#places_photos 将地方照片创建为标记图标.这是我的地图初始化代码:

var map;

function initMap() {
    // Create a map centered in Pyrmont, Sydney (Australia).
      map = new google.maps.Map(document.getElementById('map'), {
        center: {lat: -6.920812, lng: 107.604116},
        zoom: 13
      });

      var request = {
        location: map.getCenter(),
        radius: '5000',
        type: ['shopping_mall']
      };

      var service = new google.maps.places.PlacesService(map);
      service.textSearch(request, callback);
}

// Checks that the PlacesServiceStatus is OK, and adds a marker
// using the place ID and location from the PlacesService.
function callback(results, status) {
  console.log(results);
  if (status == google.maps.places.PlacesServiceStatus.OK) { …
Run Code Online (Sandbox Code Playgroud)

google-maps google-places-api

1
推荐指数
1
解决办法
739
查看次数

标签 统计

google-maps ×1

google-places-api ×1