function gmap_polyutil_encode_latlon in GMap Module 6
Same name and namespace in other branches
- 5 gmap_polyutil.inc \gmap_polyutil_encode_latlon()
- 6.2 gmap_polyutil.inc \gmap_polyutil_encode_latlon()
- 7.2 gmap_polyutil.inc \gmap_polyutil_encode_latlon()
- 7 gmap_polyutil.inc \gmap_polyutil_encode_latlon()
The following three functions will encode numbers so that they may be used in "Encoded Polylines" on Google Maps. The encoding is described here: http://code.google.com/apis/maps/documentation/polylinealgorithm.html
Numbers for latitudes/longitudes and levels are encoded slightly differently--when generating Encoded Polylines, latitudes and longitudes are encoded with gmap_polyutil_encode_signed(), and "levels" are encoded using gmap_polyutil_encode_unsigned().
1 call to gmap_polyutil_encode_latlon()
- gmap_polyutil_polyline in ./gmap_polyutil.inc 
- Simplify a set of points and generate an "Encoded Polyline" for Google Maps.
File
- ./gmap_polyutil.inc, line 30 
- Encoded polyline utilities.
Code
function gmap_polyutil_encode_latlon($x) {
  $x = round($x * 100000.0) << 1;
  if ($x < 0) {
    $x = ~$x;
  }
  return _gmap_polyutil_encode($x);
}