osmbonus 包中的路由折线不可见

Route Polyline in osmbonus pack is invisible

在这里尝试通过 osmbonus pack 进行路由,一切正常,但有一个问题,我在地图上看不到绘制为路线的多段线。 我确定它是从 (mRoadOverlay.getNumberOfPoints()) returns 41

开始生成的

我正在关注 OSMNavigator 示例 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);
        }

另外我要说的是我可以在地图上看到道路节点,所以可以肯定地说road是正确的

供日后参考:

我找到原因了, 原因是为了放大地图的字体大小,我使用了这个自定义的 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/"}));

其中我将 aTileSizePixel 更改为 512,而我的图块实际上是 256x256 ...这有助于我显示更大的图块,因此字体大小也更大,纬度和经度没问题,因为我可以通过以下方式设置点我自己在地图上的确切位置,路线节点也很好,但路线折线本身却不是,我猜它已经加载到不同的位置,这不在我检查过的视图中。