api - Google Directions not enough "steps" items in "legs" list -
i trying show direction between , b points, , optionally several waypoints between , b. managed response, no problem @ all. response little bit "inaccure" (or inexact). when search same location in google maps , in app, there big difference in amount of circles between locations. using google map directions api, travel mode is: walking. tried use google roads. tried pass waypoint coordinates roads api , build path using that, fails when place waypoints on roads travelling car not possible. see images below. can provide source, have no reputation provide more 2 links :(
google maps screenshot my app screenshot
private void drawdirections(directionresponse directionresponse) { if (directionresponse.getstatus().equals("ok")) { list<routesitem> routitems = directionresponse.getroutes(); (routesitem routesitem : routitems) { log.d(tag, "drawdirections: " + routesitem); list<legsitem> legs = routesitem.getlegs(); drawrideroute(legs); } } } private void drawrideroute(list<legsitem> legs) { log.d(tag, "drawrideroute: " + legs.tostring()); (legsitem leg : legs) { log.d(tag, "drawrideroute: leg: " + leg); (stepsitem stepsitem : leg.getsteps()) { drawstep(stepsitem); } } } private void drawstep(stepsitem stepsitem) { log.d(tag, "drawstep: step: " + stepsitem); latlng start = getlatlng(stepsitem.getstartlocation()); latlng end = getlatlng(stepsitem.getendlocation()); addcircle(start); addcircle(end); } private void addcircle(latlng latlng) { circleoptions circleoptions = new circleoptions() .center(latlng) .clickable(true) .radius(circle_radius) .fillcolor(color.cyan) .strokecolor(color.blue) .strokewidth(4); mgooglemap.addcircle(circleoptions); }
Comments
Post a Comment