Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This shows the algorithm for encoding: <a href="http://code.google.com/apis/maps/documentation/utilities/polylinealgorithm.html">http://code.google.com/apis/maps/documentation/utilities/polylinealgorithm.html</a></p> <p>A decoder is available from Prof Mark McClure at <a href="http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/decode.html">http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/decode.html</a></p> <p>Encoding uses offsets (deltas) from point to point. The offset of the first point is calculated from (0,0) so it equals the coordinates of the first point. The second point is encoded as the offset of point two from point one, and so on.</p> <p>To join two lines, you first need to find the last point of the first line, and the first point of the second line.</p> <p>Then, you calculate the offset of line two from the last point of line one, and substitute that offset for the first coordinate in the second line. Thus the second line does not start with an offset from (0,0), but an offset from the end of the first line.</p> <p>Now, the last point of the first line will need to be re-encoded to show that there is more to follow. </p> <p>Because each encoded point in each line can consist of a variable number of characters, it's not easy to find any point (even the first) without decoding the entire line.</p> <p>So: to do the work you will need to do some decoding and recoding. It's probably easiest to decode each line into an array of points and then re-encode the whole thing. Encoding is quick and easy in PHP -- see McClure's site again.</p> <p><em>This contradicts an answer given by me in the Google Maps Version 2 Group where I wrongly assumed the length of each encoded point to be strictly five characters.</em></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload