Created
June 29, 2013 20:51
-
-
Save RobSpectre/5892617 to your computer and use it in GitHub Desktop.
An example of dropping a marker on a Google Map with a fuzzy address.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <title>Rob's Awesome Map</title> | |
| <head> | |
| <script | |
| src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> | |
| <style> | |
| html, body, #map-canvas { | |
| margin: 0; | |
| padding: 0; | |
| height: 100% | |
| } | |
| </style> | |
| <script> | |
| function initialize() { | |
| var mapOptions = { | |
| zoom: 14, | |
| center: new google.maps.LatLng(40.714, -73.953), | |
| mapTypeId: google.maps.MapTypeId.ROADMAP | |
| } | |
| var map = new google.maps.Map(document.getElementById('map-canvas'), | |
| mapOptions); | |
| var geocoder = new google.maps.Geocoder(); | |
| geocoder.geocode({'address': '160 Berry St. Brooklyn, NY 11249'}, function (results, | |
| status) { | |
| console.log("merp"); | |
| if (status == "OK") { | |
| var pt = results[0].geometry.location; | |
| var marker = new google.maps.Marker({ | |
| position: pt, | |
| map: map | |
| }); | |
| }; | |
| }); | |
| } | |
| google.maps.event.addDomListener(window, 'load', initialize); | |
| </script> | |
| </head> | |
| <body> | |
| <ul> | |
| <li><a | |
| href="https://developers.google.com/maps/documentation/javascript/">Google | |
| Maps JS Docs</li> | |
| <li><a | |
| href="https://developers.google.com/maps/documentation/javascript/examples/">Example | |
| Code</a></li> | |
| <li><a | |
| href="https://developers.google.com/maps/documentation/javascript/examples/map-simple">Simple | |
| Map Example</a></li> | |
| <li><a | |
| href="https://developers.google.com/maps/documentation/javascript/examples/icon-simple">Marker | |
| Example</a></li> | |
| <li><a | |
| href="https://developers.google.com/maps/documentation/javascript/examples/map-geolocation">Geolocation | |
| Example</a></li> | |
| </ul> | |
| <div id="map-canvas"></div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment