Hi everyone,

I need to find the Latitude and Longitude values for a moving vehicle from the Google Maps, using javascripts.

Can you give the sample code, please help me.

I don't think you can do that, because it is not your page.

And I haven't found a way to find longitude and latitude on Google Maps. They don't display it.

Terraserver displays longitude and latitude:


Google Earth displays longitude and latitude, but it is not a website, in the sense that it has it's own dedicated browser.

Look at google maps api - its geo coding service returns lat and long of a point if you feed in an address or postal code.

$output= json_decode($geocode);
$latitude = $output->results[0]->geometry->location->lat;
$longitude = $output->results[0]->geometry->location->lng;

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script src="http://maps.google.com/maps?file=api&v=1&key=ADD_YOUR_KEY_HERE" type="text/javascript"></script>

<div id="map" style="width: 400px; height: 300px"></div>

<script type="text/javascript">
var map = new GMap(document.getElementById("map"));
var point = new GPoint(<?php echo $longitude; ?>,<?php echo $latitude; ?>);
 address = '<?php echo $longitude; ?>  ,<?php echo $latitude; ?>';

var mark = createInfoMarker(point, address);
function createInfoMarker(point, address) {
 var marker = new GMarker(point);
 map.centerAndZoom(point, 3);

 GEvent.addListener(marker, "click",
 function() {

 return marker;



If I understand correctly, then you need to read this.