mssmlndz / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

Ability to use TMS source #195

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Tile Map Service Specification is similar to Slippy Map, except y axis:
- TMS count y tiles from bottom to top,
- Slippy Map count tiles from top to bottom.

Conversion to TMS is done with:
y = (int)(Math.pow(2, zoomLevel) - y - 1);

This is very useful, especially for zip tilepacks using TMS.

Example using a TMS zip tilepack:
(as an overlay over Google Maps, see issue #192)

MapTileProviderBasic mProvider = new MapTileProviderBasic(context);
BitmapTileSourceBase customSource = new BitmapTileSourceBase("Tiles", null, 0, 
18, 256, ".png") {};
customSource.isSourceTMS = true;
mProvider.setTileSource(customSource);
mProvider.setUseDataConnection(false);
mTilesOverlay = new GTilesOverlay(mProvider, context);
map.getOverlays().add(0, mTilesOverlay);

Patch is attached in order to easily use a TMS source.

Original issue reported on code.google.com by Murphy2...@gmail.com on 31 Mar 2011 at 7:18

Attachments:

GoogleCodeExporter commented 9 years ago
I updated the patch for easier use and in order to also support a XYTileSource.

Example:
MapTileProviderBasic mProvider = new MapTileProviderBasic(context);
XYTileSource CUSTOM = new XYTileSource("myServer", null, 0, 18, 256, 
".png","http://myServerTMS/Tiles/");
CUSTOM.isSourceTMS = true;
mProvider.setTileSource(CUSTOM);
mTilesOverlay = new GTilesOverlay(mProvider, context);
map.getOverlays().add(0, mTilesOverlay);

Anyone to commit?

Thanks,
Julien

Original comment by Murphy2...@gmail.com on 13 Apr 2011 at 9:00

Attachments:

GoogleCodeExporter commented 9 years ago
Wouldn't it be better to just extend XYTileSource and override getY()?

Original comment by neilboyd on 26 Apr 2011 at 10:34

GoogleCodeExporter commented 9 years ago
Hi,

That's possible but I also need it into BitmapTileSourceBase.
Since XYTileSource extends from BitmapSourceBase I thought it would be nicer to 
put this option directly in the core class.
That works for BitmapTileSourceBase but not for XYTileSource, even if it 
extends from it because they're not using the same way to calculate Y.
So I changed both in my patch v2.

Do you see an easier way to do that?

Thanks,
Julien

Original comment by Murphy2...@gmail.com on 26 Apr 2011 at 8:39

GoogleCodeExporter commented 9 years ago
Hmm is that why when I have MapTiler tiles, osmdroid is looking on different 
y.png file 
:http://groups.google.com/group/osmdroid/browse_thread/thread/5aa00da755125428

Original comment by pip...@gmail.com on 6 Jun 2012 at 9:33

GoogleCodeExporter commented 9 years ago
I think so.
You can use my patch until this get merged.

Original comment by Murphy2...@gmail.com on 7 Jun 2012 at 6:12