rendering a json with direction service

浪子不回头ぞ 提交于 2019-12-24 22:40:29

问题


when i make a request for a specific latlang direction service responses with the same json. so instead of making the same requests always, i want to store the json somehow.i tried parsing the json and sent to my function which i render the responses, but it didn't work. is something like this even possible?

var direction = JSON.parse('{"routes":[{"bounds":......}');
directionRenderer.setDirections(direction);

回答1:


It's not possible by using directionRenderer.setDirections() , because not all properties of a directionsResult may be stored in JSON.

But you may of course draw the route on your own, fetch the important details (LatLng's, descriptions etc. out of the directionsResult and use them to 1. draw a polyline and 2. providing route-details)



来源:https://stackoverflow.com/questions/15721218/rendering-a-json-with-direction-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!