D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
zross
Full window
Github gist
Example of Google Places Library (grab cafes within 500m)
<!DOCTYPE html> <html> <head> <title>Place searches</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&libraries=places"></script> <script> var map; var infowindow; function initialize() { var pyrmont = new google.maps.LatLng(42.444508,-76.499491); map = new google.maps.Map(document.getElementById('map-canvas'), { center: pyrmont, zoom: 15 }); var request = { location: pyrmont, radius: 500, types: ['cafe'] }; infowindow = new google.maps.InfoWindow(); var service = new google.maps.places.PlacesService(map); service.nearbySearch(request, callback); } function callback(results, status) { if (status == google.maps.places.PlacesServiceStatus.OK) { console.log(results) for (var i = 0; i < results.length; i++) { createMarker(results[i]); } } } function createMarker(place) { var placeLoc = place.geometry.location; var marker = new google.maps.Marker({ map: map, position: place.geometry.location }); google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(place.name); infowindow.open(map, this); }); } google.maps.event.addDomListener(window, 'load', initialize); </script> </head> <body> <div id="map-canvas"></div> </body> </html>
https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places