如果在android中缩放是> 7,openstreetmap不会加载地图

时间:2015-03-04 15:20:47

标签: android openstreetmap osmdroid

OSM缩放仅适用于> 7。在我的项目中,我从服务器上下载数据。我使用volley!来下载数据。所以我设置了放大响应()。我在ovverided方法中调用方法jsonArrayRequest()

@Override
protected void addOverlays() {
    super.addOverlays();
    jsonArrayReuest("7701");
}

当这部分代码在addOverlays()方法中时,它对样本很有用。

 mMyLocationOverlay = new ItemizedOverlayWithFocus<MapOverlayItem>(items,
     new ItemizedIconOverlay.OnItemGestureListener<MapOverlayItem>() {
             @Override
             public boolean onItemSingleTapUp(final int index, final MapOverlayItem item) {
             // SingleTap
             return true;
            }
             @Override
             public boolean onItemLongPress(final int index, final MapOverlayItem item) {
            // LongPressed
             return false;
            }
     }, mResourceProxy);

但当我将其替换为

public void onResponse(JSONArray response){
....
       mMyLocationOverlay.setFocusItemsOnTap(true);
       mMyLocationOverlay.setFocusedItem(0);
       mMapView.getOverlays().add(mMyLocationOverlay);
       mRotationGestureOverlay = new RotationGestureOverlay(activity.getApplicationContext(), mMapView);
       mRotationGestureOverlay.setEnabled(false);
       mMapView.getOverlays().add(mRotationGestureOverlay);
       /* MapTileProviderBasic */
       final MapTileProviderBasic tileProvider = new MapTileProviderBasic(activity.getApplicationContext());
       final ITileSource tileSource = new XYTileSource("FietsRegionaal", null, 3, 18, 256, ".png",new String[] { "http://overlay.openstreetmap.nl/openfietskaart-rcn/" });
       tileProvider.setTileSource(tileSource);
       final TilesOverlay tilesOverlay = new TilesOverlay(tileProvider, activity.getBaseContext());
       tilesOverlay.setLoadingBackgroundColor(Color.TRANSPARENT);
       mMapView.getOverlays().add(tilesOverlay);
       /* MiniMap */
       {
           MinimapOverlay miniMapOverlay = new MinimapOverlay(activity.getApplicationContext(),
           mMapView.getTileRequestCompleteHandler());
           mMapView.getOverlays().add(miniMapOverlay);
       }
       mMapView.getController().setZoom(16);
       IGeoPoint geoPoint = new GeoPoint(filialList.get(position).getPosition1(),filialList.get(position).getPosition2());
        //mMyLocationOverlay.getFocusedItem().getPoint();
       mMapView.getController().animateTo(geoPoint);
}

0 个答案:

没有答案