GPX to Google Polyline. Part 2

In the previous post I have described my modified python code convert GPX data to Google polyline. Well, there were some people who used the script, surprisingly, and asked for some additions/modifications. The Google algorithm, especially if used in Javascript, allows for specifying levels how the polyline will be plotted. This can really help with plotting very complex polylines at different zoom levels. The idea is that at a particular zoom level many points in the poliline will be invisible anyways. Thus there is no need to spend resources drawing them.

However, the problem with making the algorithm to calculate these levels is not that straightforward. I found two algorithms to do this – one and two. One part of the code was to implement the Ramer-Douglas-Peucker algorithm to reduce the number of points needed depending on the set small number. After that it was just simple encoding of the levels using a similar number to character conversion.

The final code is at the same place in bitbucket.  It is possible that the new feature may not work correctly. If it is the case, please let me know.

Advertisements
This entry was posted in Computers and tagged , , , , . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s