What are "levels" in polyline encoding/decoding, and exactly how do they relate to map zoom levels in Google Maps API v3 or Android Maps API v2?
The only description I can find is from the Interactive Polyline Encoder Utility:
Polylines in Google Maps are formed as a set of latitude/longitude pairs. In addition, for each vertex (location) in an encoded polyline, a level can be specified indicating that the location should appear on that level and any level higher (i.e. any decrease in zoom.). If a location does not appear on a given level, then the line will go from the last visible location to the next visible location. Note that the first and last locations must be Level 3 points, otherwise the polyline won't display on all levels.
Does "Level 3" correspond to a zoom level of 3 in the Google Maps API v3 or Android Maps API v2?
Here's what a zoom level of 3 looks like in the Google Maps API v3 (no polyline is displayed - this is simply to illustrate what the "zoom level = 3" looks like):
Should a "Level 3" point be displayed if we zoom out one step further, to zoom Level 2?
The quote:
Note that the first and last locations must be Level 3 points, otherwise the polyline won't display on all levels.
...seems to indicate that Level 3 points should be displayed on all levels, including zoom levels 2, 1, and 0.
I'm wondering if the statement:
...a level can be specified indicating that the location should appear on that level and any level higher (i.e. any decrease in zoom.)
...should actually be:
...a level can be specified indicating that the location should appear on that level and any level higher (i.e. any increase in zoom.)
"decrease in zoom" doesn't seem correct, because Level 18 (very zoomed in) points would be rendered on Level 3 (very zoomed out).
"increase in zoom" seems to generally make sense (you'd render a Level 3 zoomed out point also when you zoom in to Level 18 - in other words, you add detail as you zoom in closer to the map) - however, it seems to contradict the statement that Level 3 points should be rendered at lower zoom levels 2, 1, and 0.
On Android, the open-source android-maps-utils library includes a method to decode polylines, but it doesn't handle levels, so I can't tell if there is a readily-available mapping to Android Maps API v2 zoom levels.
Can anyone provide clarity on this?