2

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>
Jack Torris
  • 814
  • 5
  • 23
  • 38
  • 2
    There is no API method to create that place card. You can do it by yourself though, with an absolute positionned element or a [custom control](https://developers.google.com/maps/documentation/javascript/examples/control-custom). – MrUpsidown Feb 27 '15 at 11:33
  • 1
    or maybe a [custom overlay](https://developers.google.com/maps/documentation/javascript/customoverlays) – duncan Feb 27 '15 at 11:47
  • thanks for your reply. you can check here: http://project.demotestserver.com/bin/te.php i created custom control and display the location on top left. i want to add view on google map link. is it possible? how can i do that? – Jack Torris Feb 27 '15 at 12:04
  • @JackTorris so you know the coordinates. Add to the control a link, e.g. to https://www.google.co.uk/maps/place/34%C2%B023%2749.2%22S+150%C2%B038%2738.4%22E/@-34.2166435,150.5295037,9z/data=!4m2!3m1!1s0x0:0x0?hl=en – duncan Feb 27 '15 at 14:12

0 Answers0