Search code examples
androidmapsofflineosmdroid

osmdroid - offline map, not showing map after scrolling zoomed map


I have some problems with showing map in the offline map. I'm using osmdroid + tile downloaded via MOBAC and putted on the phone.

I download the tiles from particular area, I can see unzoomed map, everything seems ok for me. Then I zoom the map and looks ok but if I scroll then I see unloaded fragments of map. This screen should show what I meant.

Unzoomed:

enter image description here

Zoomed:

enter image description here

Zoomed after scroll:

enter image description here

and here is my code:

public class OSMDroidMapActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) 
{
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    MapView mapView = new MapView(this,256);

    //mapView.setClickable(true);

    mapView.setBuiltInZoomControls(true);

    setContentView(mapView);

    // set initial zoom-level
    mapView.getController().setZoom(15);
    mapView.setMultiTouchControls(true);
    mapView.setClickable(true);

    mapView.getController().setCenter(new GeoPoint(54.178181,15.579021));
    //keeps the mapView from loading online tiles using network connection.
    mapView.setUseDataConnection(false);    
    mapView.setTileSource(TileSourceFactory.MAPQUESTOSM);

}

}

Is there any option to force view to render one more time or smth like that. This is not problem of not having the tiles in the memory of phone, cause when I unzoom map and then zoom this fragment which u can see at "Zoomed after scroll:" screen, the map is showed properly. In my opinion this is caused by rendering small fragment of map when I zoom it.

I searched for answer, most of question are about situation when map isn't showed at all(problem with tiles). I found this question, but changing version of jar file caused only more problem with map.

Edit: Additional info: for osmdroid I'm using this lib jar file: osmdroid-android-4.2.jar and here is the screen from MOBAC

mobac screen

and then I click create atlas button.

Path to tiles: SD Card\osmdroid\tiles\MapQuest

tiles is the rar file which is atlas created as output from mobac


Solution

  • Since osmdroid 4.2, the default format of MapQuestOSM tile source is "jpg". So your conversion to png is not necessary. EDIT - And this could be a part of your issue. Refer to this post: Download maps for osmdroid

    Do you have sub-dirs in SD Card\osmdroid\tiles\MapQuest, or is this directory COMPLETELY empty? If it's not empty, the tiles displayed could come from this cache, not from your zip file. This could explain the behaviour (zip file not used at all, cached tiles used when available). To be 100% sure: if it's not empty, delete it.

    And could you also specify exactly the full path location of your MOBAC zip file on your device?