Can I use the osmdroid library to display my own map. The folder structure looks the following

mapname (folder)
 |-zoomlevel (folder)
   |- X_Y.png (a lot of images)

I thought I could load the tiles using a custom source but it seems nothing that I do works

mResourceProxy = new DefaultResourceProxyImpl(getApplicationContext());

// Add tiles layer with custom tile source

final MapView mapView = new MapView( this, 256 );

final ITileSource tileSource = new TileSource(Environment.getDataDirectory().getPath() + "/exampleapp/mymap", null);
mapView.setTileSource(tileSource);

mapView.setMultiTouchControls(true);

setContentView(mapView);
mMapView = mapView;

mMapView.getController().setZoom(5);

And my custom source

public class TileSource extends BitmapTileSourceBase{

    public TileSource(String aName, string aResourceId) {

        super(aName, aResourceId, 1, 6, 256, ".png");
    }

    @Override
    public String getTileRelativeFilenameString(MapTile tile) {
        final StringBuilder sb = new StringBuilder();
        sb.append(pathBase());
        sb.append('/');
        sb.append(tile.getZoomLevel());
        sb.append('/');
        sb.append(tile.getX());
        sb.append('_');
        sb.append(tile.getY());
        sb.append(imageFilenameEnding());
        return sb.toString();

    }
}

asked 17 Feb '13, 00:12

Bartinger's gravatar image

Bartinger
11112
accept rate: 0%

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×157
×40
×12
×6

question asked: 17 Feb '13, 00:12

question was seen: 4,062 times

last updated: 17 Feb '13, 00:12

powered by OSQA