Android Example MapsDecodePolyline

yfleury

Active Member
Licensed User
Longtime User
for this
B4X:
Dim mpiCurrent As MapsPointItem
I have an error
Unknown type: MapsPointItem
Are you missing a library reference?

How to correct that
 

yfleury

Active Member
Licensed User
Longtime User
Many thanks DonManfred

I pass the json into http://basic4ppc.com:51042/json/index.html
to get this code
B4X:
Dim parser As JSONParser
parser.Initialize(<text>)
Dim root As Map = parser.NextObject
Dim routes As List = root.Get("routes")
For Each colroutes As Map In routes
 Dim summary As String = colroutes.Get("summary")
 Dim copyrights As String = colroutes.Get("copyrights")
 Dim legs As List = colroutes.Get("legs")
 For Each collegs As Map In legs
  Dim duration As Map = collegs.Get("duration")
  Dim text As String = duration.Get("text")
  Dim value As Int = duration.Get("value")
  Dim start_location As Map = collegs.Get("start_location")
  Dim lng As Double = start_location.Get("lng")
  Dim lat As Double = start_location.Get("lat")
  Dim distance As Map = collegs.Get("distance")
  Dim text As String = distance.Get("text")
  Dim value As Int = distance.Get("value")
  Dim start_address As String = collegs.Get("start_address")
  Dim end_location As Map = collegs.Get("end_location")
  Dim lng As Double = end_location.Get("lng")
  Dim lat As Double = end_location.Get("lat")
  Dim end_address As String = collegs.Get("end_address")
  Dim via_waypoint As List = collegs.Get("via_waypoint")
  Dim steps As List = collegs.Get("steps")
  For Each colsteps As Map In steps
   Dim duration As Map = colsteps.Get("duration")
   Dim text As String = duration.Get("text")
   Dim value As Int = duration.Get("value")
   Dim start_location As Map = colsteps.Get("start_location")
   Dim lng As Double = start_location.Get("lng")
   Dim lat As Double = start_location.Get("lat")
   Dim distance As Map = colsteps.Get("distance")
   Dim text As String = distance.Get("text")
   Dim value As Int = distance.Get("value")
   Dim travel_mode As String = colsteps.Get("travel_mode")
   Dim html_instructions As String = colsteps.Get("html_instructions")
   Dim end_location As Map = colsteps.Get("end_location")
   Dim lng As Double = end_location.Get("lng")
   Dim lat As Double = end_location.Get("lat")
   Dim polyline As Map = colsteps.Get("polyline")
   Dim points As String = polyline.Get("points")
  Next
  Dim traffic_speed_entry As List = collegs.Get("traffic_speed_entry")
 Next
 Dim warnings As List = colroutes.Get("warnings")
 Dim bounds As Map = colroutes.Get("bounds")
 Dim southwest As Map = bounds.Get("southwest")
 Dim lng As Double = southwest.Get("lng")
 Dim lat As Double = southwest.Get("lat")
 Dim northeast As Map = bounds.Get("northeast")
 Dim lng As Double = northeast.Get("lng")
 Dim lat As Double = northeast.Get("lat")
 Dim overview_polyline As Map = colroutes.Get("overview_polyline")
 Dim points As String = overview_polyline.Get("points")
 Dim waypoint_order As List = colroutes.Get("waypoint_order")
Next
Dim geocoded_waypoints As List = root.Get("geocoded_waypoints")
For Each colgeocoded_waypoints As Map In geocoded_waypoints
 Dim types As List = colgeocoded_waypoints.Get("types")
 For Each coltypes As String In types
 Next
 Dim geocoder_status As String = colgeocoded_waypoints.Get("geocoder_status")
 Dim place_id As String = colgeocoded_waypoints.Get("place_id")
Next
Dim status As String = root.Get("status")

Then for
B4X:
Sub MapsDecodePolyline(encoded As String, poly As List)
I understand I use MapsDecodePolyline(points, ***but where can find poly as list***)

The best way for me to understand, is to see how it work in a small project if you have time to do it.
 

wes58

Active Member
Licensed User
Longtime User
Maybe you can look at this thread https://www.b4x.com/android/forum/threads/b4x-google-geocoding-rest-api.83870/. Post #3 has a small example - it is probably done differently than in this thread.
 

DonManfred

Expert
Licensed User
Longtime User
The best way for me to understand, is to see how it work in a small project if you have time to do it.
ME? No, why? YOU have the issue. I told you the solution.

You now are asking another question which you should post in a new thread. And honestly you should have done this with the first question too!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…