How can I get zoom levels to decode a polyline fro

2019-09-12 13:03发布

Following this polyline decoder class from @Kenny:

int[] decodedZoomLevels = PolylineDecoder.decodeZoomLevels(levels);
GeoPoint[] gPts = PolylineDecoder.decodePoints(points, decodedZoomLevels.length);

I'm trying to draw the route from Barcelona to Madrid with Google Maps Directions API:

<DirectionsResponse>
  <status>OK</status>
  <route>
    <leg>
      ...
    </leg>
    <copyrights>Datos de mapa ©2012 Google, Tele Atlas</copyrights>
    <overview_polyline>
      <points>
        cjr{F_u(...)rw@bD~]ln@xo@fnB`M|iAxEvV
      </points>
    </overview_polyline>
  <route>
<DirectionsResponse>

I manage to read the XML response and get \DirectionsResponse\route\overview_polyline\points polyline string; but I cannot find the <levels> tag.

I'm trying to draw smoother line (route) when the users zooms in but freeing smartphone's CPU when the zoom is out.

Am I using wrong API? Or this class is outdated?

Thanks in advance...

1条回答
孤傲高冷的网名
2楼-- · 2019-09-12 13:54

ZoomLevel is econded inside the polyline "string". In the Kenny's class just give as 2nd parameter to "decodePoints" method the size of the polyline string.

Look at the bottom of this 1 and I wonder you will understand more.

查看更多
登录 后发表回答