Page 1 of 1

CGGoogleMaps lat long for directions

Posted: Sat Jul 23, 2011 2:58 pm
by Mantlet
Hi,

I'm trying to get the lat and long variables into the directions window. Since {$marker->get_marker_id()} and {$marker->get_title()} both work and show up in {$marker|print_r}, I also tried {$marker->get_lat()} and {$marker->get_long()}.

However, those don't give anything, while they seem filled in the {$marker|print_r}.

What is the proper syntax to get the lat and long from a marker?

Re: CGGoogleMaps lat long for directions

Posted: Tue Aug 21, 2012 10:47 pm
by Emir
It's a bit outadated...but somebody can find it useful.

In order to get latitude and logitude of current marker inside CGGoogleMaps, you should use following methods:
  • $marker->get_latitude() and
  • $marker->get_longitude()
Keep in mind that these method will return data with incorrect number format when called from template, so after correction it would like like this:

{$marker->get_latitude()|number_format:6:".":","}