PHILADELPHIA REFLECTIONS
Musings of a Philadelphia Physician who has served the community for six decades

Return to Home

Find your location

Click the button at the top of your browser to allow it to share your location.

Your browser does not support iframes.

Here's the key Javascript/HTML code (thanks to http://maxheapsize.com):

<head>

<script type="text/javascript">
// <![CDATA[

var map;
var geocoder;

function initialize() {
   map = new GMap2(document.getElementById("map_canvas"));
   map.setCenter(new GLatLng(34, 0), 1);
   geocoder = new GClientGeocoder();
   }

if (navigator.geolocation) {
  
   navigator.geolocation.getCurrentPosition(function(position) {  
	var address = position.coords.latitude+","+position.coords.longitude;
	geocoder.getLocations(address, addAddressToMap);
 }); 
  
} else {
  alert("I'm sorry, but geolocation services are not supported by your browser.");
}  

function addAddressToMap(response) {
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Sorry, we were unable to geocode that address");
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        marker = new GMarker(point);
        map.setCenter(point, 13);
        map.addOverlay(marker);
		var addr = document.getElementById('address');
		addr.firstChild.data = place.address;
      }
    }

// ]]>
</script>

</head>

<body onload="initialize()">

<div id="map_canvas" style="width: 500px; height: 300px"></div>

(1825)

Please Let Us Know What You Think


(HTML tags provide better formatting)

Because of robot spam we ask you to confirm your comment: we will send you an email containing a link to click. We apologize for this inconvenience but this ensures the quality of the comments. (Your email will not be displayed.)
Thank you.