Message 1 of 4
Challenge: Encoded Polyline Algorithm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Looking for a challenge?
Try to create this Encoded Polyline Algorithm in AutoLISP:
https://developers.google.com/maps/documentation/utilities/polylinealgorithm
Example:
(setq ptList '((38.5 -120.2) (40.7 -120.95) (43.252 -126.453)))
(EncodePolyline ptList)
_p~iF~ps|U_ulLnnqC_mqNvxq`@ <<--- The correct output string
Why is this relevant?
Many mapping APIs can't afford the extreme overhead of very lengthy polyline coordinate arrays that get provided as parameters; and they don't always need to keep the full precision of a polyline when they're merely overlaying a vector line on a map image. So there needed to be a way to effectively reduce the amount of input data while still outputting the desired product (even if a little precision was lost in the process, it shouldn't be noticeable in the end result).
Attached is my go at it
Happy Coding!
~DD