JavaScript – Google Maps With Pointer

Google Map API is an interface for you to put maps on your webpage. It also can be used as an input method for a user to select his address exactly on a map. So, the user does not only type in his address, city, country and other location information as we can found generally on ordinary submit forms. They mark their exact address on the map. Sounds great, isn’t it? Google map API is generally used in real estates websites to provide a more informative and readable detail.

Demo

To move the marker, you may perform a single right click on a new location.

Source Code

<html>
    <head>
        <title>Google Maps API Example</title>

        <script
            src="http://maps.google.com/maps?file=api&v=1&key=<your api key>"
            type="text/javascript">
        </script>
        <!--
            <your api key> is a unique key provided by google map
            You have to replace <your api key> with your api key
            You can get your API key at

http://code.google.com/apis/maps/signup.html

        -->
    </head>
    <body>
        <div id="map" style="width:400px;height:400px"></div>
        To move the marker, you may perform a single right click
        on a new location.

        <script language="JavaScript">
            //By    : Xhanch Studio
            //URL   : http://xhanch.com/

            var map;

            // Define default marker location
            var default_longitute = "-122.141944";
            var default_latitute = "37.441944";

            // Marker/Pointer moved handler
            function move_marker(latlng){
                if(latlng){
                    //Get the selected corrdinate
                    lng = latlng.lng();
                    lat = latlng.lat();

                    //Remove all markers
                    map.clearOverlays();

                    //Set new marker
                    var point = new GPoint(lng, lat);
                    var marker = new GMarker(point);
                    map.addOverlay(marker);
                }
            }

            // Google Map initialize
            if (GBrowserIsCompatible()) {
                map = new GMap(document.getElementById("map"));

                map.addControl(new GLargeMapControl());
                map.addControl(new GMapTypeControl());

                //Set default marker, the zoom we set to 7
                var point = new GPoint(default_longitute, default_latitute);
                map.centerAndZoom(point,7);
                var marker = new GMarker(point);
                map.addOverlay(marker);

                // Assign a single right click event handle
                GEvent.addListener(map, "singlerightclick", function(point){
                    var latlng = map.fromContainerPixelToLatLng(point);
                    move_marker(latlng);
                });
            }
        </script>
    </body>
</html>

Click here to support our work. Thanks :)

Incoming search terms:

source code php right click and add marker place to google map, gevent addlistener right click, google map pointer, google maps pointer, google map php moving marker, gevent addlistener rightclick, google maps marker click singlerightclick, google maps pointer javascript, fromcontainerpixeltolatlng, javascript pointer map, javascript pointers for google maps, Google map with pointer, \singlerightclick\ point, google maps with pointer, google pointer, wordpress pointer api, javascript google maps pointers, javascript goolge maps, javascript mark point, javascript search google maps, javascript pointer google, php google map move marker, javascript google map location pointer, google地圖 script, how to add a pointer to google map api, how to add google map pointer in java, how to add pointers in google maps, how to put pointers on google Map, how to puy destination pointers on google maps, how to show maps with pointers in java script, java script for put pointer in google map, javascript code to search location in google map, javascript for google maps, map fromcontainerpixeltolatlng in javascript, map pointer in javascript, right click on google map java script code, map singlerightclick, script search point nya google map, search as google maps in php javascript, Search marker GEvent addListener, select javascript:marker click, singlerightclick, singlerightclick google maps, url(#default-marker) javascript, ver pointer de google maps javascript, right click on google earth to put a marker, put pointer on google maps, put pointer on googl emap, map pointer javascripy, singlerightclick get latlng, map singlerightclick point, mark point google maps, mark point on google maps javascript, mark setinfo google maps, marker pointer on google map, move marker with google map api, php suburb location select script, put map with pointer on site, wordpress google maps move pointer, add pointers location in google map using javascript, gevent addlistener singlerightclick, GEvent addListener(marker singlerightclick function(), gevent listener right click, gmarker rightclick, google api move pointer, google api pointer, google api source to destination code in javascript, google code map api pointer array, google com pojnter, google map api and pointer, gevent addlistener marker right click, comment submits real estates, addlistener mouse actionscript right gevent, addlistener right click, addlistener(marker rightclick, api google pointers, build google map with pointers, city pointer for google map api, code for mark location on google map in php, code toadd pointers in google maps, coding for move pointer from source to destination in google map, comment submit real estates, google map api singlerightclick point get lat, google map get location singlerightclick, google maps javascript api pointer, google maps javascript pointer, google maps location pointer, google maps move pointer, google maps pointer script, google maps pointers wordpress, google maps set default marker, google maps set info pointer, google maps with a pointer, googlemaps javascript pointer, google maps api singlerightclick, google maps api pointers, google map javascript pointer, google map javasript rightclick, google map pointer script, google map script with address pointer, xhanch

Related posts:

  1. PHP Script – Google Page Rank (PR) Checker
  2. Action Script – Walled Bouncing Ball
  3. PHP Script – Plant Tycoon Species List
  4. PHP Script – Transform Number To English Words
  5. PHP Script – Create PDF With FPDF

Posted on 2010-03-08 by Susanto BSc in Free Script, JavaScript
Tagged as: , , , , , , , , ,

2 Responses to “JavaScript – Google Maps With Pointer”

  1. tanvir says:

    Can i use this code commercially ?

    thank you

Leave a Reply

You must be logged in to post a comment.

Latest Tweets