1

I have a directions service in my php page for which I take destination latlng value from another php page

var dest='<?php echo $dest;?>';

The directions do display. I want to show the address of destination from the latlng for which I had used reverse-geocoding:

var geo = new google.maps.Geocoder();
geo.geocode({'latLng':dest},function(results,status){
document.getElementById('txtDestination').innerHTML = results[1].formatted_address;
});

But it is not taking the value of latlng throwing the error:

InvalidValueError: in property latLng: not a LatLng or LatLngLiteral: not an Object

I had test value of dest using alert() it shows correct but I don't why it doesnt take in Geocoder()

Santhucool
  • 1,656
  • 2
  • 36
  • 92
Dimple
  • 453
  • 9
  • 22
  • Refer this: http://stackoverflow.com/questions/20585055/uncaught-invalidvalueerror-setposition-not-a-latlng-or-latlngliteral-in-prope – Santhucool May 28 '15 at 11:56
  • What is the value of `dest`? Sounds like it isn't a LatLng or a LatLngLiteral. Please provide a [Minimal, Complete, Tested and Readable example](http://stackoverflow.com/help/mcve) that demonstrates the issue. – geocodezip May 28 '15 at 14:19
  • `dest` is the latlng value which i pass from anchor tag from another php file – Dimple May 29 '15 at 04:30

0 Answers0