You are here

function _gmap_polyutil_encode in GMap Module 5

Same name and namespace in other branches
  1. 6.2 gmap_polyutil.inc \_gmap_polyutil_encode()
  2. 6 gmap_polyutil.inc \_gmap_polyutil_encode()
  3. 7.2 gmap_polyutil.inc \_gmap_polyutil_encode()
  4. 7 gmap_polyutil.inc \_gmap_polyutil_encode()
2 calls to _gmap_polyutil_encode()
gmap_polyutil_encode_latlon in ./gmap_polyutil.inc
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
gmap_polyutil_encode_levels in ./gmap_polyutil.inc

File

./gmap_polyutil.inc, line 40
Encoded polyline utilities.

Code

function _gmap_polyutil_encode($x) {
  $result = '';
  while ($x >= 32) {
    $result .= chr((32 | $x & 31) + 63);
    $x >>= 5;
  }
  $result .= chr(($x & 31) + 63);
  return $result;
}