custom google map add place card

2019-04-10 23:45发布

i have created custom google map using php. it shows marker, location and info window.

it works fine without any issue.

i want to add place card in it. check below screenshot. How can i display Place card on my custom map. enter image description here

i tried following code to display custom location.

   <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
         <script>
         var saveWidget;

         function initialize() {

     var myLatlng = new google.maps.new google.maps.LatLng(-34.397, 150.644);
          var mapOptions = {
            zoom: 4,
            center: myLatlng
          };

        var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
        var contentString = '<div id="content">'+
              '<div id="siteNotice">'+
              '</div>'+
              '<h1 id="firstHeading" class="firstHeading">location</h1>'
              '</div>';

        var infowindow = new google.maps.InfoWindow({  content: contentString });
        var marker = new google.maps.Marker({
              position: myLatlng,
              map: map,
              title: 'Uluru (Ayers Rock)'
          });

        google.maps.event.addListener(marker, 'click', function() {   infowindow.open(map,marker); });  }

        google.maps.event.addDomListener(window, 'load', initialize);
        </script>

0条回答
登录 后发表回答