Android – osmdroid offline files

I have an osmdroid map. I want to load offline tiles from the osmdroid Zip or gemf file of mobac. I investigated it everywhere. I said it just put it in sdcard / osmdroid. But it doesn't work. Do I need to change something in the code?

 public class Map extends Activity {
  private IMapView mMapView;
  private static IMapController mMapController;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map);

    mMapView = (MapView) findViewById(R.id.mapview);
    ((MapView) mMapView).setBuiltInZoomControls(true);

    mMapController = mMapView.getController();
    mMapController.setZoom(13);
    GeoPoint geoPecs = new GeoPoint(46.070833,18.233056);
    mMapController.setCenter(geoPecs);

mProvider = new MapTileProviderBasic(getApplicationContext());
    mCustomTileSource = new XYTileSource("Turaterkep", null, 13, 15, 256, ".png", "http://users.atw.hu/perzsa/map/Turaterkep/");
    mProvider.setTileSource(mCustomTileSource);
    mTilesOverlay = new TilesOverlay(mProvider,this.getBaseContext());

    mMapView.getOverlays().add(mTilesOverlay);

Update: I managed to load tiles online, including the example to osmdroid. I also updated the code. I think I must start with this example. Maybe I can load from localhost? Sick examination

Picture: http://i.stack.imgur.com/CoZT1.png

resolvent:

I encountered the same problem. I solved this problem using mapnik's online tiles. In this way, my application created a path (phone / osmdroid / tiles / mapnik) in my mobile device

    mMapView.setTileSource(TileSourceFactory.Mapnik);

You can also add tiles source by adding them to XML files and MapView:

    tilesource="Mapnik"

Don't forget to specify that you don't want the application to download data by adding the following:

      mMapView.setUseDataConnection(false);

When finished, you can let the application use the offline tile, just follow the following guidelines: http://www.haakseth.com/?p=30

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>