Link to home
Start Free TrialLog in
Avatar of k_hoffhines
k_hoffhinesFlag for United States of America

asked on

Google Maps Intergration of Address Location Map

I have a C# application that will give me the address of a house sale, I am wanting to attach the location of the google maps on the website how could I accomplish this I will only have the physical address of the house.
ASKER CERTIFIED SOLUTION
Avatar of Molnár István
Molnár István
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of k_hoffhines

ASKER


          <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps API Sample</title>
    <script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAuPsJpk3MBtDpJ4G8cqBnjRRaGTYH6UMl8mADNa0YKuWNNa8VNxQCzVBXTx2DYyXGsTOxpWhvIG7Djw" type="text/javascript"></script>
    <script type="text/javascript">

        var map = null;
        var geocoder = null;

        function initialize() {
            if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map_canvas"));
                map.setCenter(new GLatLng(37.4419, -122.1419), 13);
                geocoder = new GClientGeocoder();
            }
        }

        function showAddress(address) {
            if (geocoder) {
                geocoder.getLatLng(
          address,
          function (point) {
              if (!point) {
                  alert(address + " not found");
              } else {
                  map.setCenter(point, 13);
                  var marker = new GMarker(point);
                  map.addOverlay(marker);
                  marker.openInfoWindowHtml(address);
              }
          }
        );
            }
        }

    </script>
  </head>
  <body onload="initialize()" onunload="GUnload()" style="font-family: Arial;border: 0 none;">
    <form action="#" onsubmit="showAddress(this.address.value); return false">
       <p>
         <input type="text" size="60" name="address" value="1600 Amphitheatre Pky, Mountain View, CA" />
         <input type="submit" value="Go!" />
       </p>
       <div id="map_canvas" style="width: 500px; height: 300px"></div>
     </form>
  </body>
</html>
I did find this online, but I want it to "pull" the sql data were the address value is at any suggestions?
if you have just one address, you can create a server variable and pass to javascript:
var myClientVariable = '<%= myServerVariable %>';
the server variable must be Public