You must Sign In to post a response.
  • Category: .NET

    Google Map API search by Logitude and Latitude

    Dear Friends,

    I have one query related to Google Api. I have to use Google Map in my application but I want the Google map based on the entered Longitude and Latitude. Means I want to achieve if I enter Logitude and Latitude then I want exact position in google map. Please help me I am not getiing how can I do this. I have got many api where I can enter place name like Cannought, Newdelhi, India and I will get the location in Google Map but I don't want this.

    Thanks,
    Praveen
  • #648618
    Hello,

    Check below code

    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Google Maps</title>
    <script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=" type="text/javascript"></script>
    </head>
    <body >
    <div id="map" style="width: 550px; height: 450px"></div>


    <script type="text/javascript">


    if (GBrowserIsCompatible()) {


    function createMarker(point,html) {
    var marker = new GMarker(point);
    GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(html);
    });
    return marker;
    }

    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(17.5304303,73.8567437),5);


    }

    else {
    alert("Sorry, the Google Maps API is not compatible with this browser");
    }


    </script>
    </body>

    </html>

    Regards
    Mr.Rajesh
    Software Engg.

  • #648622
    hi

    try
    this

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:v="urn:schemas-microsoft-com:vml">
    <meta http-equiv="refresh" content="5" />
    <head>
    <title>Untitled Page</title>
    <script src="http://maps.google.com/maps?file=api&v=2&
    key=ABQIA" type="text/javascript"></script>
    <script type="text/javascript">
    function loadEarth(mapdiv) {
    if (GBrowserIsCompatible()) {
    var point;
    if(!mapdiv)return true;
    var map=new GMap2(document.getElementById("map"));
    map.addControl(new GOverviewMapControl());
    map.enableDoubleClickZoom();
    map.enableScrollWheelZoom();
    map.addControl(new GMapTypeControl());
    map.addControl(new GSmallMapControl());
    var marker = new GMarker(new GLatLng(37.4419,-122.1419));
    map.setCenter(new GLatLng(37.4419,-122.1419),17);
    GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml("hii");});
    map.addOverlay(marker);

    }

    }
    </script>
    </head>
    <body onload="loadEarth('map')" onunload="GUnload()" style="
    background-color:Transparent">
    <div id="map" style="width: 800px; height: 500px"></div>
    </body>
    </html>

    Regards
    Sagar pawar
    Software developer


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.