Using osmdroid for own tile server?

1508 views
Skip to first unread message

Nickw

unread,
Feb 20, 2011, 9:41:11 AM2/20/11
to osmdroid
Hi,

Am wanting to use the osmdroid MapView to show my own custom tiles
(i.e. Freemap tiles) in an Android app.

It looks like the way to do this is to create an instance of
XYTileSource. However this appears to be a non-public class and
therefore cannot be instantiated outside of its package. I realise
that I could modify the osmdroid tile source, or create my own class
extending from OnlineTileSourceBase myself, but is there a better way
of doing this? Why is XYTileSource non-public incidentally?

Thanks,
Nick

mkurtz

unread,
Feb 21, 2011, 9:17:07 AM2/21/11
to osmdroid
Nick,

Actually, I'm not sure why they (including QuadTileSource) aren't
public. They should be. Please see Issue 163.

-Marc

Nickw

unread,
Feb 22, 2011, 4:52:27 PM2/22/11
to osmdroid
Hi Marc,

OK - thanks.
A small test activity appears to work perfectly with my custom tile
source if I make XYTileSource, and its constructor, public (reproduced
here in case anyone else finds it useful...)

public class OpenTrail extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
MapView map = (MapView)findViewById(R.id.map);
XYTileSource freemap = new XYTileSource
("Freemap", null, 0, 16, 256, ".png", "http://
tilesrv.sucs.org/ofm/");
map.setTileSource(freemap);
map.getController().setZoom(13);
map.getController().setCenter(new GeoPoint(51050000,-720000));
}
}

BTW is the ResourceProxy argument necessary in the XYTileSource
constructor? My code works if this is set to null (or
ResourceProxy.string.unknown).

Nick

alexx

unread,
Feb 26, 2011, 7:06:14 AM2/26/11
to osmd...@googlegroups.com
I'm interested in Nick's question as well:
Is the ResourceProxy argument necessary in the TileSource constructor? Or is it ok to use null?

Regards,
Alex

Reply all
Reply to author
Forward
0 new messages