Pregunta

Using the Nokia Here (Javascript) API, is it possible to have a Polyline - defined by a relatively sparse but potentially large set of coordinates - snap to roads without making a route query?

If you are unable to positively surprise me, and this is not possible as I assume, any additional suggestions for achieving the same result with a minimum amount of routing queries (or other approach you find 'optimal')? Thus far I am thinking of dividing the coordinate sets into smaller sets if required, getting the route for them separately, then combining the data of the resulting Shapes (Strips) and caching it all in a database for later display..

¿Fue útil?

Solución

If you are using the Enterprise Routing API you could do the following:

1) Make a series of routing requests to HERE from your point A to your point B using the manueverattribute=none&routeattributes=none parameters in the request which suppresses unwanted information. Store the routeId in your database:

http://route.st.nlp.nokia.com/routing/6.2/calculateroute.json?...&manueverattribute=none&routeattributes=none&app_id=YOUR_APP_ID&app_code=YOUR_APP_CODE .

2) When a user queries your sparse database from from your point A to your point B , retrieve the routeId from your database and make a query to HERE using the getroute endpoint passing in the id from previous request as shown:

http://route.st.nlp.nokia.com/routing/6.2/getroute.json?routeid=your_route_id&app_id=your_app_id&app_code=your_app_code&manueverattribute=none&routeattributes=shape

This way you can get away with storing the minimal amount of information yourself - i.e. a matrix of all possible start points against all possible end points, and use the RESTful routing API to do all the intermediate calculations.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top