gurujain / osmbonuspack

Automatically exported from code.google.com/p/osmbonuspack
0 stars 0 forks source link

road.mNodes.size() = 0 #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
road.mNodes.size()

Original issue reported on code.google.com by patricio...@gmail.com on 26 Nov 2012 at 8:37

Attachments:

GoogleCodeExporter commented 8 years ago
See the attached file please!!

Original comment by patricio...@gmail.com on 26 Nov 2012 at 9:04

GoogleCodeExporter commented 8 years ago
Nodes are instructions, like "turn left at street xx", "turn right at road 
yy",... 
I've not tried your FROM/TO path, but having no instruction doesn't necessarily 
means there is an error. 
The right way to check errors is looking if Road.mStatus==STATUS_DEFAULT. 

If you really have an error, here is a good way to analyze what happens: look 
at the logcat, you will see the url sent: copy/paste it in a browser, and see 
how the answer look like. 

Original comment by mathieu....@gmail.com on 28 Nov 2012 at 9:45

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I attached the code... Becouse the same example was working five days ago. I 
just put some markers un the map... Like tutorial 1. And it was working ok!! I 
tried to change from/to... But the result it's the same... I also copy the path 
from/to of your example in Paris and it doesn't work. So i decide to create an 
issue becouse it's really extrange...
Please if you have a minute, see the code... Thank you very much!!

Original comment by patricio...@gmail.com on 29 Nov 2012 at 10:44

GoogleCodeExporter commented 8 years ago
I forgot... If you download your app example "OSMBonusPackDemo_v2.4.1.apk" it 
doesn't work either. The app draw the path but doesn't put the markers... 
Becouse the arrayList mNodes size = 0...

Original comment by patricio...@gmail.com on 29 Nov 2012 at 10:49

GoogleCodeExporter commented 8 years ago

Original comment by patricio...@gmail.com on 29 Nov 2012 at 11:08

Attachments:

GoogleCodeExporter commented 8 years ago
Oh my God, OSRM service has changed their input parameters! And their online 
doc has not been updated yet. 
I just fixed that, and published corrected jar and apk (v3.0, embarking some 
other minor improvements). I will commit OSRM source change very soon. 

Original comment by mathieu....@gmail.com on 7 Dec 2012 at 6:11

GoogleCodeExporter commented 8 years ago
Well... Thank you very much. I really appreciate your quickly response!! And 
congratulations for your work!!

Original comment by patricio...@gmail.com on 7 Dec 2012 at 7:16

GoogleCodeExporter commented 8 years ago
source commited now. 
Thanks for noticing the issue!

Original comment by mathieu....@gmail.com on 7 Dec 2012 at 9:27

GoogleCodeExporter commented 8 years ago
I'm having the same problem. I already have the updated library.

Original comment by ricardoa...@gmail.com on 16 Oct 2013 at 2:23

GoogleCodeExporter commented 8 years ago
Me too... I have the same problem, I'm using the osmbonuspack_v4.4.jar library.
I don't know why road.mNodes.size() = 0 
but I have resolved changing road.mNodes.size() to road.mRouteHigh.size()
more exactly, replacing the original code (in Tutorial_1) with this code

Drawable nodeIcon = getResources().getDrawable(R.drawable.marker_node);
        for (int i=0; i<road.mRouteHigh.size(); i++){
                GeoPoint node = road.mRouteHigh.get(i);
                Marker nodeMarker = new Marker(map);
                nodeMarker.setPosition(node);
                nodeMarker.setIcon(nodeIcon);
                nodeMarker.setTitle("Step "+i);
                map.getOverlays().add(nodeMarker);
        }  

Thank you very much for your work

Original comment by torell...@gmail.com on 26 Apr 2014 at 1:06

GoogleCodeExporter commented 8 years ago
I have found a solution, you must put this code

StrictMode.ThreadPolicy policy = new StrictMode.
ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy); 

at the beginning of your main activity

this method is valid just in debug fase, but after this fase is better change 
it with an AsyncTask

Original comment by torell...@gmail.com on 26 Apr 2014 at 5:13

GoogleCodeExporter commented 8 years ago
The problem was try to connect in HTTPConnection mode inside of GUIThread
for that reason we need to define 

StrictMode.ThreadPolicy policy = new 
StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy); 

alternatively, we can declare an AsynTask to Connect in HTTPConnection mode
because the call 

Road road = roadManager.getRoad(waypoints);

uses HTTPConnection

Original comment by torell...@gmail.com on 26 Apr 2014 at 5:22

GoogleCodeExporter commented 8 years ago
Your analysis and solution are correct. 
You can also refer to the "Important note about network calls" in Tutorial_0. 

Original comment by mathieu....@gmail.com on 26 Apr 2014 at 8:35

GoogleCodeExporter commented 8 years ago
Thank you for your answer and consideration

Original comment by torell...@gmail.com on 27 Apr 2014 at 7:45