Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

google Directions API

I read this guide now I can build a correct request to receive the xml file containg the directions from address A to address B. What I need is some instructions and example on how to read this xml to draw the obtained directions on an Android MapView. I'd like also to know what represents this tag in the xml:

<overview_polyline>
<points>
a~l~Fjk~uOnzh@vlbBtc~@tsE`vnApw{A`dw@~w|tNtqf@l{Yd_Fblh@rxo@b}
@xxSfytAblk@xxaBeJxlcBb~t@zbh@jc|Bx}C`rv@rw|@rlhA~dVzeo@vrSnc}Axf]fjz@
xfFbw~@dz{A~d{A|zOxbrBbdUvpo@`cFp~xBc`Hk@nurDznmFfwMbwz@bbl@lq~@lo
Ppxq@bw_@v|{CbtY~jGqeMb{iF|n~mbDzeVh_Wr|Efcx`Ij{kE}mAb~uF{cNd}xBjp]
fulBiwJpgg@|kHntyArpb@bijCk_Kv~eGyqTj_|@`uV`k|DcsNdwxAott@r}q@_gc@nu`CnvH
x`k@dse@j|p@zpiAp|gEicy@`omFvaErfo@igQxnlApqGze~AsyRzrjAb__@ftyB}pIlo_B
flmA~yQftNboWzoAlzp@mz`@|}_@fda@jakEitAn{fB_a]lexClshBtmqAdmY_hLxiZd~XtaBndgC
</points>
<levels>BBBAAAAABAABAAAAAABBAAABBAAAABBAAABABAAABABBAABAABAAAABABABABBABAABB</levels> 
</overview_polyline> 

thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
197 views
Welcome To Ask or Share your Answers For Others

1 Answer

I found this example on the web I'll try to use it. polyline decoding example

private List<GeoPoint> decodePoly(String encoded) {

  List<GeoPoint> poly = new ArrayList<GeoPoint>();
  int index = 0, len = encoded.length();
  int lat = 0, lng = 0;

  while (index < len) {
      int b, shift = 0, result = 0;
      do {
          b = encoded.charAt(index++) - 63;
          result |= (b & 0x1f) << shift;
          shift += 5;
      } while (b >= 0x20);
      int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
      lat += dlat;

      shift = 0;
      result = 0;
      do {
          b = encoded.charAt(index++) - 63;
          result |= (b & 0x1f) << shift;
          shift += 5;
      } while (b >= 0x20);
      int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
      lng += dlng;

      GeoPoint p = new GeoPoint((int) (((double) lat / 1E5) * 1E6),
           (int) (((double) lng / 1E5) * 1E6));
      poly.add(p);
  }

  return poly;
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...