javascript - Google Maps - Places API to return multiple results with markers? -
is there way can next google places api?
search multiple places (nike store + mcdonalds) , place them on map custom icon markers each result? i.e.: nike symbol nike store , mcdonalds "m" symbol mcdonald's stores? this..quick illustration image - can't upload here don't have plenty reputation.
i have tried multiple places search maps.google.com take using pipeline in between maximum of 2 places.
can share illustration here or jsfiddle of how go above custom icon markers?
i can't see documentation on this.
thank you.
//multiple locations have no issue getting working when i'm using lat,lng passed in info array, i'm unsure how 2 things above - putting in 2 places in array (without lat,lng) , having different custom marker icons each of 2 places results. each place should output 100+ results , plotted on map.
function initialize() { var mapoptions = { zoom: 10, center: new google.maps.latlng(-33.9, 151.2) } var map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); setmarkers(map, beaches); } //i need places inputting place names in array "nike", "mcdonalds" don't have latitude , longitudes every result.. yet var beaches = [ ['bondi beach', -33.890542, 151.274856, 4], ['coogee beach', -33.923036, 151.259052, 5], ['cronulla beach', -34.028249, 151.157507, 3], ['manly beach', -33.80010128657071, 151.28747820854187, 2], ['maroubra beach', -33.950198, 151.259302, 1] ]; function setmarkers(map, locations) { // add together markers map (wondering how can set different marker icons each places info set in array above? var image = { url: 'images/beachflag.png', size: new google.maps.size(20, 32), origin: new google.maps.point(0,0), anchor: new google.maps.point(0, 32) }; var shape = { coords: [1, 1, 1, 20, 18, 20, 18 , 1], type: 'poly' }; (var = 0; < locations.length; i++) { var beach = locations[i]; var mylatlng = new google.maps.latlng(beach[1], beach[2]); var marker = new google.maps.marker({ position: mylatlng, map: map, icon: image, shape: shape, title: beach[0], zindex: beach[3] }); } } google.maps.event.adddomlistener(window, 'load', initialize);
javascript google-maps google-places-api google-places
No comments:
Post a Comment