rosmons / osmbonuspack

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

No Polyline drawn #102

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1."Hello, Routing World!"
2.Using codes from OSMNavigation sample

What is the expected output? What do you see instead?
to "see" the route polyline

What version of the products are you using (Android SDK, osmdroid,
OSMBonusPack)?
Android: 4.2.2 and 4.4.2
OSMDroid: 4.2
OSMBonusPack: 5.0

Please provide any additional information below.

Trying to routing via osmbonus pack here, everything works almost fine, but 
there is a problem which is I can not see the polyline drawn as the route on my 
map. I'm sure it has een generated since (mRoadOverlay.getNumberOfPoints()) 
returns 41

And I'm following the OSMNavigator Sample 
https://code.google.com/p/osmbonuspack/source/browse/trunk/OSMNavigator/src/com/
osmnavigator/MapActivity.java

void updateUIWithRoad(Road road){
            mRoadNodeMarkers.getItems().clear();
            TextView textView = (TextView)findViewById(R.id.tv_main_routeInfo);
            textView.setText("");
            List<Overlay> mapOverlays = map.getOverlays();
            if (mRoadOverlay != null){
                Log.d("Polylinenopoin",String.valueOf(mRoadOverlay.getNumberOfPoints()));
                mapOverlays.remove(mRoadOverlay);
                mRoadOverlay = null;
                Log.d("POLYLINE","1");
            }
            if (road == null){
                return;}
            if (road.mStatus == Road.STATUS_TECHNICAL_ISSUE)
                Toast.makeText(map.getContext(), "Technical issue when getting the route", Toast.LENGTH_SHORT).show();
            else if (road.mStatus > Road.STATUS_TECHNICAL_ISSUE) //functional issues
                Toast.makeText(map.getContext(), "No possible route here", Toast.LENGTH_SHORT).show();
            mRoadOverlay = RoadManager.buildRoadOverlay(road, Main.this);

            String routeDesc = road.getLengthDurationText(-1);
            mRoadOverlay.setTitle("route" + " - " + routeDesc);
            String det = String.valueOf(mRoadOverlay.getColor()) + "- " + String.valueOf(mRoadOverlay.getWidth());
            Log.d("Polydet",det);
            map.getOverlays().add(mRoadOverlay);
            //we insert the road overlay at the "bottom", just above the MapEventsOverlay,
            //to avoid covering the other overlays.
            putRoadNodes(road);
            map.invalidate();
            //Set route info in the text view:
            textView.setText(routeDesc);
        }
Also I need to say that I can see road Nodes on the map, so it's safe to say 
that road is correct

StackOverflow: 
http://stackoverflow.com/questions/27799022/route-polyline-in-osmbonus-pack-is-i
nvisible

Original issue reported on code.google.com by mu.aliza...@gmail.com on 6 Jan 2015 at 12:55

GoogleCodeExporter commented 9 years ago
Which RoadManager are you using? 
Could you provide also the piece of code doing the call? 
Nothing in the logcat?

Original comment by mathieu....@gmail.com on 7 Jan 2015 at 10:07

GoogleCodeExporter commented 9 years ago
Both OSRM and google results the same, I even used MapQuest and still no luck

you may check my code in the attachments

Nothing in the logcat, except that I can see that different start and end point 
result into different polyline.getNumberofPoints() 
Also the Nodes appears to be ok on the OSRM although they are not ok on google! 
specially near the end, they get close together and also the last point wont be 
shown

thanks in advance

Original comment by mu.aliza...@gmail.com on 7 Jan 2015 at 11:50

Attachments:

GoogleCodeExporter commented 9 years ago
I found the reason,
the reason was that to enlarge the font size of the maps I used this custom 
XYTileSource:

map.setTileSource(new XYTileSource("Google Terrian",
                ResourceProxy.string.bing, 10, 17, 512, ".jpg", new String[] {
                "http://otile1.mqcdn.com/tiles/1.0.0/map/",
                "http://otile2.mqcdn.com/tiles/1.0.0/map/",
                "http://otile3.mqcdn.com/tiles/1.0.0/map/",
                "http://otile4.mqcdn.com/tiles/1.0.0/map/"}));

in which I had changed the aTileSizePixel to 512, while my tiles were in fact 
256x256 ... this helped me to show tiles bigger and hence bigger font size, the 
latitude and longitude were alright as I could set points by myself on the map 
in exact location, also the route Nodes were alright, the route Polyline itself 
however was not, I guess it had been loaded in a different location which was 
not in the view I had checked.

Anyway, I suggest that, you change the method in which you dray the polyline on 
the map to be similar to the method which nodes are drawn on the map so the 
location would be alright and also we can use this hack (entering 512 instead 
of 256) and the font size would be ok.

thanks 

Original comment by mu.aliza...@gmail.com on 11 Jan 2015 at 10:05

GoogleCodeExporter commented 9 years ago
Thanks a lot for this feedback. I will investigate for the solution. 

Original comment by mathieu....@gmail.com on 11 Jan 2015 at 5:59

GoogleCodeExporter commented 9 years ago
I tried in OSMNavigator (the demo app), changing this piece of code in 
MapActivity.java (line 166): 

    MAPBOXSATELLITELABELLED = new MapBoxTileSource("MapBoxSatelliteLabelled", ResourceProxy.string.mapquest_aerial, 1, 19, 512, ".png");

It worked fine! The route polyline was drawn from start to destination markers, 
exactly as expected. 
There should be an other issue somewhere. 

(BTW, your hack is excellent, greater labels being easier to read)

Original comment by mathieu....@gmail.com on 14 Jan 2015 at 10:18

GoogleCodeExporter commented 9 years ago
Mapquest tiles are not good eblnough for me so I use google tiles woth
XYTilesource and jpg format for reducing the size of offline data
Perhaps there is a difference being made here

Original comment by mu.aliza...@gmail.com on 15 Jan 2015 at 5:17