Map API

Nutiteq Maps Lib SDK enables developing advanced mobile mapping applications.
Platforms: Android, RIM BlackBerry, Java ME (J2ME)
Download maps API SDK »
Untitled Document

Products

» View demos
» Downloads

Uudised

Viimane: Tue, 17 May 2011 13:21:59
Teema: Nutimap Eesti kaardi asemele
Veel uudiseid »

How to display a route between two locations on CloudMade?

9 replies [Last post]
bogzonfire
User offline. Last seen 1 year 27 weeks ago. Offline
Joined: 04/22/2010

Hi, I'm trying to use CloudMade's route service.

I want to display a Route between two locations in my standalone application, but there isn't any tutorial in CloudMade's website that handle this.

How can I display the Route?

Appreciate any help.

FailinimiSuurus
cmroute_android.zip12.15 KB
mapssdk_rimui.zip541.69 KB
jaak
User offline. Last seen 13 hours 22 min ago. Offline
Joined: 06/19/2008

I attached here a basic CloudMade routing project for Android. It just shows route between two predefined points nearby Amsterdam.

On other platforms it would be similar. As minimum you need to do following:
1. implement a DirectionsWaiter to get route results
2. parse RouteInstruction[] array from getInstructions(), I created points on map there
3. use getRouteLine() to get route line
4. create CloudMadeDirections and call .execute() to start routing.
5. it is advised to call route in separate thread, as it can be a blocking IO call (ANR in Android etc). The library itself does not do this, this is up to your application, also shown in given sample

/JaakL

bogzonfire
User offline. Last seen 1 year 27 weeks ago. Offline
Joined: 04/22/2010

i've tried those basic CloudMade routing project for Android. I've implemented in Blackberry platform, but the route still not showed.
What should I do?
Thanks in advance

jaak
User offline. Last seen 13 hours 22 min ago. Offline
Joined: 06/19/2008

It is hard to tell without seeing the code or what is in your logs.

I attached now also recently updated RIMUI demo app, which includes also CloudMade routing between same two points as in Android demo, plus some more features of the maps library. It has one possibly relevant thing different: it does not make separate requests for CloudMade tokens, but it reuses token from CloudMade maps. HTTP POST requests can be problematic on BlackBerry; for example this sample worked fine on some BB SDK emulators, but on some others HTTP POST just fails (times out). Note also that the test route is quite long, with many points; and on real devices it is probably too slow.

/JaakL

joemoul
User offline. Last seen 50 weeks 5 days ago. Offline
Joined: 08/18/2010

Hi, i'm trying to implement j2me directions tutorial using CloudMade Routing. The map works fine and i can get the directions using CloudMade token. The problem is the route between 2 locations is not showed and i get the "Network error" message.

Error > Error in task runner: Space character in URL
...............
Error > CloudMade Directions network error

Am i doing something wrong?
Thanks in advance

jaak
User offline. Last seen 13 hours 22 min ago. Offline
Joined: 06/19/2008

The tutorial sample code has error in CloudMade token request. Basically it did not have content-length header set for HTTP request, if you fix it then it should start work.

/JaakL

navad
User offline. Last seen 36 weeks 5 days ago. Offline
Joined: 11/03/2010

I also get a Network error. It works fine on the simulator but on the device (8900 Curve) the log says:

Error > Network error has occured during direction service execution
Error > CloudMade Directions network error
Error > Network error 2 :

jaak
User offline. Last seen 13 hours 22 min ago. Offline
Joined: 06/19/2008

ClodeMade token request which is part of Directions service does not add ";deviceside" to the token request URL, which is a known bug.

Current solution would be that in BlackBerry you should use only CloudMadeDirections with constructor where you can add token in app, and you can get it from cloudmade map service.

/JaakL

jaak
User offline. Last seen 13 hours 22 min ago. Offline
Joined: 06/19/2008

ps. the specific reasons behind issues of joemoul and navad seem to be quite different ones, even through they give similar error message in same service.

/JaakL