0

I have generated a set of maps, zipped it under name tiles.zip and copied in sdcard/osmdroid folder. Here are atlas setting and folder content.

enter image description here

enter image description here

I used the example project here. It runs without error but my maps are not presented in MapView. Here is MainActivity and layout:

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapView;


public class MainActivity extends AppCompatActivity {

    public static final GeoPoint BERLIN = new GeoPoint(52.516667, 13.383333);
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        MapView mapView = (MapView) findViewById(R.id.mapview);
        mapView.setClickable(true);
        mapView.setBuiltInZoomControls(true);
        mapView.setMultiTouchControls(true);
        mapView.setUseDataConnection(true);

       mapView.setTileSource(TileSourceFactory.MAPQUESTOSM);
       IMapController mapViewController = mapView.getController();
       mapViewController.setZoom(15);
       mapViewController.setCenter(BERLIN);


    }
}

and

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="${packageName}.${activityClass}">

    <org.osmdroid.views.MapView
        android:id="@+id/mapview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clickable="true" />

</RelativeLayout>

As I tested, if I unzip the maps and add them as assets, maps are shown but in wrong order.

any idea what's wrong? thanks

EDIT1

Here my log:

enter image description here

Behy
  • 483
  • 7
  • 23
  • 1
    Have a look here: http://stackoverflow.com/questions/22862534/download-maps-for-osmdroid/22868462#22868462 – MKer Apr 20 '16 at 20:47
  • it seems that the problem is during reading directory (pls look at EDIT1 – Behy Apr 21 '16 at 08:08
  • @Behy did you fixed the problem !? I have the same one right now ! –  Aug 23 '17 at 06:53

1 Answers1

1


1) Do you have Berlin in your zoom level 15 tiles? If not, try to set zoom level to 1 or change map center to your region.
2) you do not need to create so many layers in MOBAC. Just select you area, zoom levels and add it at once. It might help. Other setting are same like in my project

  • it could be another problem but according to the app log (EDIT1), it seems that the problem is during reading directory. – Behy Apr 21 '16 at 08:09
  • 1
    @Behy Do you have those permissions in your android manifest file? [osmdroid wiki](https://github.com/osmdroid/osmdroid/wiki/How-to-use-the-osmdroid-library) – Ladislav Hofman Apr 21 '16 at 08:58
  • it seems that the problem was due to using a samsung phone. no problem when a Nexus is used – Behy Apr 21 '16 at 09:58