Drupal - Get the latitude and longitude from the user ip
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).