Get the latitude and longitude from the user ip I am trying to get the latitude and longitude from the user who connected to my website to draw or show his position on a map, but it showed him in the wrong postion. Is there any way to get the accurate latitude and longitude?

    &lt;?php drupal_add_js('http://maps.google.com/maps/api/js?sensor=true'); ?&gt;
     `&lt;script type="text/javascript"&gt;
        //document.write("Hello World!");
        jQuery(document).ready(function () {
            function initialize(att,lon,title) {

            var mapOptions = {
                zoom: 8,
                center: new google.maps.LatLng(att,lon),
                mapTypeId: google.maps.MapTypeId.ROADMAP //TERRAIN
            };
            map = new google.maps.Map(document.getElementById("map_canvas2"),mapOptions);
            map.disableDefaultUI = true;

            var marker = new google.maps.Marker({
                map: map,
                icon:Drupal.settings.basePath+'themes/bartik/logo.png',
                position: map.getCenter()
            });

            var infowindow = new google.maps.InfoWindow();
            infowindow.setContent('&lt;div class="title-map"&gt;'+title+'&lt;/div&gt;');
            jQuery('.title-map').parent().removeAttr('style');

            google.maps.event.addListener(marker, "click", function() {

                infowindow.open(map, marker);

            });
        }
        jQuery.getJSON('http://api.wipmania.com/jsonp?callback=?', function (data) {
            initialize(data.latitude,data.longitude,'title');
        });
    &lt;/script&gt;
    &lt;?php

     echo "&lt;div id="map_canvas2" style="width:605px; height:465px"&gt;&lt;/div&gt;";
?&gt;
Converting an IP to a latitude and longitude isn't a good idea since the user could be using a proxy. A better way would be to use HTML5 geolocation, which tries to get a location based on a couple of parameters: IP, wireless connection, cell tower location, GPS ...

Try:

navigator.geolocation.getCurrentPosition(show_map);

function show_map(position) {
  initialize(position.coords.latitude, position.coords.longitude, 'title');
}


More info on HTML5 geolocation here, make sure you have a fallback in case the browser doesn't support geolocation or the user declines your request to share his/her location (graceful degradation).