Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I created a tile source that suppoort jpg, you can take a look and adapt your case, Please note that getTileRelativeFilenameString won't contain .title ext. That part will be added by (MapTileFilesystemProvider)</p> <pre><code>import java.io.File; import java.io.InputStream; import java.util.Random; import org.osmdroid.ResourceProxy; import org.osmdroid.ResourceProxy.string; import org.osmdroid.tileprovider.MapTile; import org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase.LowMemoryException; import org.osmdroid.tileprovider.tilesource.ITileSource; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; public class MapTilerCustomDataSource implements ITileSource { private static int globalOrdinal = 0; private final int mMinimumZoomLevel; private final int mMaximumZoomLevel; private final int mOrdinal; protected final String mName; protected final String mImageFilenameEnding; protected final Random random = new Random(); private final int mTileSizePixels; private final string mResourceId; public MapTilerCustomDataSource() { mResourceId = null; mOrdinal = globalOrdinal++; mName = "MapquestOSM"; mMinimumZoomLevel = 0; mMaximumZoomLevel = 20; mTileSizePixels = 256; mImageFilenameEnding = ".jpg"; } @Override public String getTileRelativeFilenameString(final 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(); } @Override public Drawable getDrawable(String aFilePath) throws LowMemoryException { try { // default implementation will load the file as a bitmap and create // a BitmapDrawable from it final Bitmap bitmap = BitmapFactory.decodeFile(aFilePath); if (bitmap != null) { return new BitmapDrawable(bitmap); } else { // if we couldn't load it then it's invalid - delete it try { new File(aFilePath).delete(); } catch (final Throwable e) { } } } catch (final OutOfMemoryError e) { System.gc(); } return null; } @Override public Drawable getDrawable(InputStream aFileInputStream) throws LowMemoryException { try { // default implementation will load the file as a bitmap and create // a BitmapDrawable from it final Bitmap bitmap = BitmapFactory.decodeStream(aFileInputStream); if (bitmap != null) { return new BitmapDrawable(bitmap); } } catch (final OutOfMemoryError e) { System.gc(); } return null; } @Override public int ordinal() { return mOrdinal; } @Override public String name() { return mName; } public String pathBase() { return mName; } public String imageFilenameEnding() { return mImageFilenameEnding; } @Override public int getMinimumZoomLevel() { return mMinimumZoomLevel; } @Override public int getMaximumZoomLevel() { return mMaximumZoomLevel; } @Override public int getTileSizePixels() { return mTileSizePixels; } @Override public String localizedName(final ResourceProxy proxy) { return proxy.getString(mResourceId); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload