de.fhpotsdam.unfolding.tiles
Class MBTilesLoaderUtils
java.lang.Object
de.fhpotsdam.unfolding.tiles.MBTilesLoaderUtils
public class MBTilesLoaderUtils
- extends java.lang.Object
Loads map tile images from a MBTiles SQLite database.
You need to provide the jdbcConnectionString to connect to the database file. e.g.
"./data/my-map.mbtiles"
This class is part of the Unfolding map
library. See TileMill for
Processing for more information.
Method Summary |
protected static processing.core.PImage |
getAsImage(byte[] bytes)
Converts the byte array into a PImage. |
static processing.core.PImage |
getMBTile(int column,
int row,
int zoomLevel,
java.lang.String jdbcConnectionString)
Loads the tile for given parameters as image. |
protected static byte[] |
getMBTileData(int column,
int row,
int zoomLevel,
java.lang.String jdbcConnectionString)
Loads the MBTile data from the database as blob, and returns it as byte array. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SQLITE_JDBC_DRIVER
public static final java.lang.String SQLITE_JDBC_DRIVER
- See Also:
- Constant Field Values
MBTilesLoaderUtils
public MBTilesLoaderUtils()
getMBTile
public static processing.core.PImage getMBTile(int column,
int row,
int zoomLevel,
java.lang.String jdbcConnectionString)
- Loads the tile for given parameters as image.
- Parameters:
column
- The column of the tile.row
- The row of the tile.zoomLevel
- The zoom level of the tile.jdbcConnectionString
- The path to the MBTiles database.
- Returns:
- The tile as PImage, or null if not found.
getMBTileData
protected static byte[] getMBTileData(int column,
int row,
int zoomLevel,
java.lang.String jdbcConnectionString)
throws java.lang.Exception
- Loads the MBTile data from the database as blob, and returns it as byte array.
- Parameters:
column
- The column of the tile.row
- The row of the tile.zoomLevel
- The zoom level of the tile.
- Returns:
- The tile as byte array with image information, or an empty array if not found.
- Throws:
java.lang.Exception
getAsImage
protected static processing.core.PImage getAsImage(byte[] bytes)
- Converts the byte array into a PImage. Expects the byte array to be in ARGB (RGB with alpha
channel).
Adapted from toxi
- Parameters:
bytes
- The image information as byte array.
- Returns:
- A PImage.