javascript - Google Map API - Infowindow display google place API information -


i not sure how go this.

what want: want display information might find if go https://www.google.com/maps , search farmers' market.

i want info window provides address, hours of operation, , possibly additional information google maps provides business.

what have now: have angular js code block populates array looks following:

var locations = [   ['findlay market', 39.115398, -84.518481, 5],   ['hyde park farmers' market', 39.139601, -84.442496, 4],   ['lettuce eat farmers' market', 39.166134, -84.611613, 3],   ['college hill farm market', 39.195641, -84.545453, 2],   ['anderson farmers' market', 39.078364, -84.350539, 1] ]; 

then use infowindow display name of farmers market.

i know add new table database hours , additional information , use create angular js card display in infowindow... hoping there way use google map api google places api information instead of storing in database.

thanks uksz able use below code me information needed.

<!doctype html> <html>     <head>     <title>place details</title>     <meta name="viewport" content="initial-scale=1.0, user-scalable=no">     <meta charset="utf-8">     <style>         html, body, #map-canvas {             height: 100%;             margin: 0px;             padding: 0px         }     </style>     <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true&libraries=places"></script>     <script>     function initialize() {         var map = new google.maps.map(document.getelementbyid('map-canvas'), {     center: new google.maps.latlng(39.115398, -84.518481),     zoom: 15 });  var request = {     location: map.getcenter(),     radius: '500',     query: 'findlay market' };  var service = new google.maps.places.placesservice(map); service.textsearch(request, callback);  function callback(results, status) {     if (status == google.maps.places.placesservicestatus.ok) {         var marker = new google.maps.marker({             map: map,             place: {                 placeid: results[1].place_id,                 location: results[1].geometry.location             }         });         var infowindow = new google.maps.infowindow();         google.maps.event.addlistener(marker, 'click', function() {             var content = results[1].name + '<br>' +                            results[1].formatted_address + '<br>' +                           results[1].opening_hours + '<br>' +                           results[1].place_id + '<br>';             infowindow.setcontent(content);             infowindow.open(map, this);             });         }     } } google.maps.event.adddomlistener(window, 'load', initialize); </script> </head>     <body>         <div id="map-canvas"></div>     </body> </html> 

so don't know if understood question correctly, if want display information google places api, can use theirs getdetails() function. return object. if don't want store object, why not deleting object after each time user example switches view? way not store information in database, @ least not permanently.

have one!

here full getdetails() manual:

https://developers.google.com/maps/documentation/javascript/places#place_details_requests


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -