abhinav-adtechs / osmbonuspack

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

route not displayed on mapView after Tutorial Step 1 #26

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create new project with mapActivity
2. Create standard mapView code like in Tutorial step 1
3. try to display route from start and endpoint on map

What is the expected output? What do you see instead?
mapView with displayd route, but I only see the mapView without route.

What version of the product are you using?
libs:
android-support-v4.jar
osmbonuspack_v3.6.jar
osmdroid-android-3.0.10-javadoc.jar
osmdroid-android-3.0.10.jar
slf4j-android-1.5.8.jar

HTC Legends as mobile device
problem exists also on emulators.

Please provide any additional information below.

Code: 
package com.example.helloroutedisplay;

import java.util.ArrayList;

import org.osmdroid.bonuspack.routing.OSRMRoadManager;
import org.osmdroid.bonuspack.routing.Road;
import org.osmdroid.bonuspack.routing.RoadManager;
import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapController;
import org.osmdroid.views.MapView;
import org.osmdroid.views.overlay.PathOverlay;

import android.os.Bundle;
import android.app.Activity;

public class MainActivity extends Activity {

    @Override public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);        
        MapView map = (MapView) findViewById(R.id.map);
        map.setTileSource(TileSourceFactory.MAPNIK);
        GeoPoint startPoint = new GeoPoint(48.13, -1.63);
        MapController mapController = map.getController();
        mapController.setCenter(startPoint);
        mapController.setZoom(9);
        RoadManager roadManager = new OSRMRoadManager();
        ArrayList<GeoPoint> waypoints = new ArrayList<GeoPoint>();
        waypoints.add(startPoint);
        waypoints.add(new GeoPoint(48.4, -1.9)); //end point
        Road road = roadManager.getRoad(waypoints);
        PathOverlay roadOverlay = RoadManager.buildRoadOverlay(road,  
                map.getContext());
        map.getOverlays().add(roadOverlay);
        map.invalidate();
    }
}

attached picture shows the map activity on emulator without route :( 

Original issue reported on code.google.com by MaurinRa...@googlemail.com on 14 Aug 2013 at 7:04

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I did follow every step from the tutorial, do I maybe have forgotten anything 
not listed there (permissions, ...) ? 

My LogCat says:
08-18 13:02:31.650: D/BONUSPACK(336): Leg: 0-12, length=42.123999999999995km, 
duration=1601.0s
08-18 13:02:31.662: D/BONUSPACK(336): OSRMRoadManager.getRoad - finished

But it is not shown on the map! 

Original comment by MaurinRa...@googlemail.com on 18 Aug 2013 at 1:16

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
If I change to bycycle modes or any other than fastest, the getRoad Command 
fails caused by bad request Server error, but then I have at least the straigh 
line from start to end point on the map. 

If I add the endpoint to the roadoverlay after it was created with:
roadOverlay.addPoint(new GeoPoint(48.4, -1.9));
I do have a straigh line from (I dunno where.. seems strange! (attached)) to 
this endpoint again... Any Ideas? 

Original comment by MaurinRa...@googlemail.com on 19 Aug 2013 at 4:19

Attachments:

GoogleCodeExporter commented 8 years ago
I confirm there is an issue about road shapes when using OSRM provider. No 
error, duration and length are OK, but there is no shape shown. To be 
investigated. 
MapQuest roads are OK. 

Original comment by mathieu....@gmail.com on 19 Aug 2013 at 5:38

GoogleCodeExporter commented 8 years ago
Apparently OSRM changed the precision in road shapes returned. 
Now properly taken into account in osmbonuspack v3.7. 

Original comment by mathieu....@gmail.com on 20 Aug 2013 at 8:50

GoogleCodeExporter commented 8 years ago
great, thanks. But I am new to osmbonuspack and when I noticed MapQuest works 
fine, I just used the MapQuestRoadManager and everything's fine for me :)

Original comment by MaurinRa...@googlemail.com on 20 Aug 2013 at 8:52