function gmap_polyutil_dp_encode in GMap Module 7.2
Same name and namespace in other branches
- 5 gmap_polyutil.inc \gmap_polyutil_dp_encode()
- 6.2 gmap_polyutil.inc \gmap_polyutil_dp_encode()
- 6 gmap_polyutil.inc \gmap_polyutil_dp_encode()
- 7 gmap_polyutil.inc \gmap_polyutil_dp_encode()
Implementation of the Douglas-Peucker polyline simplification algorithm.
See: http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/algorithm.html
Parameters
array $points: An array of coordinate pairs.
Return value
array An array of keys => weights; the keys correspond with indices of points in the $points array. Some points may be insignificant according to the algorithm--they will not have entries in the return array. The "weights" are actually the point's distance from the line segment that it subdivides.
Deprecated
use GmapPolylineToolbox::getInstance()->setPoints($points)->getDPEncode();
File
- ./
gmap_polyutil.inc, line 123 - Encoded polyline utilities.
Code
function gmap_polyutil_dp_encode($points) {
include_once drupal_get_path('module', 'gmap') . '/lib/Drupal/gmap/GmapPolylineToolbox.php';
return GmapPolylineToolbox::getInstance()
->setPoints($points)
->getDPEncode();
}