Package org.oscim.tiling.source.mapfile
Class MapDatabase
java.lang.Object
org.oscim.tiling.source.mapfile.MapDatabase
- All Implemented Interfaces:
ITileDataSource
A class for reading binary map files.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intstatic intReduce points on-the-fly while reading from map files.static intstatic booleanWay filtering reduces the number of ways returned to only those that are relevant for the tile requested, leading to performance gains, but can cause line clipping artifacts (particularly at higher zoom levels). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Implementations should cancel their IO work and returnvoiddispose()Implementations should cancel and release all resourcesvoidquery(MapTile tile, ITileDataSink sink) readLabels(Tile tile) Reads only labels for tile.readLabels(Tile upperLeft, Tile lowerRight) Reads data for an area defined by the tile in the upper left and the tile in the lower right corner.readMapData(Tile tile) Reads all map data for the area covered by the given tile at the tile zoom level.readMapData(Tile upperLeft, Tile lowerRight) Reads data for an area defined by the tile in the upper left and the tile in the lower right corner.readPoiData(Tile tile) Reads only POI data for tile.readPoiData(Tile upperLeft, Tile lowerRight) Reads POI data for an area defined by the tile in the upper left and the tile in the lower right corner.voidrestrictToZoomRange(int minZoom, int maxZoom) Restricts returns of data to zoom level range specified.booleansupportsTile(Tile tile) Returns true if MapDatabase contains tile.booleanwayAsLabelTagFilter(List<Tag> tags) Returns true if a way should be included in the result set for readLabels() By default only ways with names, house numbers or a ref are included in the result set of readLabels().
-
Field Details
-
wayFilterEnabled
public static boolean wayFilterEnabledWay filtering reduces the number of ways returned to only those that are relevant for the tile requested, leading to performance gains, but can cause line clipping artifacts (particularly at higher zoom levels). The risk of clipping can be reduced by either turning way filtering off or by increasing the wayFilterDistance which governs how large an area surrounding the requested tile will be returned. For most use cases the standard settings should be sufficient. -
wayFilterDistance
public static int wayFilterDistance -
SIMPLIFICATION_MIN_ZOOM
public static int SIMPLIFICATION_MIN_ZOOMReduce points on-the-fly while reading from map files. -
SIMPLIFICATION_MAX_ZOOM
public static int SIMPLIFICATION_MAX_ZOOM
-
-
Constructor Details
-
MapDatabase
- Throws:
IOException
-
-
Method Details
-
getTileSource
-
query
- Specified by:
queryin interfaceITileDataSource- Parameters:
tile- the tile to load.sink- the callback to handle the extracted map elements.
-
dispose
public void dispose()Description copied from interface:ITileDataSourceImplementations should cancel and release all resources- Specified by:
disposein interfaceITileDataSource
-
cancel
public void cancel()Description copied from interface:ITileDataSourceImplementations should cancel their IO work and return- Specified by:
cancelin interfaceITileDataSource
-
readLabels
Reads only labels for tile.- Parameters:
tile- tile for which data is requested.- Returns:
- label data for the tile.
-
readLabels
Reads data for an area defined by the tile in the upper left and the tile in the lower right corner. Precondition: upperLeft.tileX <= lowerRight.tileX && upperLeft.tileY <= lowerRight.tileY- Parameters:
upperLeft- tile that defines the upper left corner of the requested area.lowerRight- tile that defines the lower right corner of the requested area.- Returns:
- map data for the tile.
-
readMapData
Reads all map data for the area covered by the given tile at the tile zoom level.- Parameters:
tile- defines area and zoom level of read map data.- Returns:
- the read map data.
-
readMapData
Reads data for an area defined by the tile in the upper left and the tile in the lower right corner. Precondition: upperLeft.tileX <= lowerRight.tileX && upperLeft.tileY <= lowerRight.tileY- Parameters:
upperLeft- tile that defines the upper left corner of the requested area.lowerRight- tile that defines the lower right corner of the requested area.- Returns:
- map data for the tile.
-
readPoiData
Reads only POI data for tile.- Parameters:
tile- tile for which data is requested.- Returns:
- POI data for the tile.
-
readPoiData
Reads POI data for an area defined by the tile in the upper left and the tile in the lower right corner. This implementation takes the data storage of a MapFile into account for greater efficiency.- Parameters:
upperLeft- tile that defines the upper left corner of the requested area.lowerRight- tile that defines the lower right corner of the requested area.- Returns:
- map data for the tile.
-
restrictToZoomRange
public void restrictToZoomRange(int minZoom, int maxZoom) Restricts returns of data to zoom level range specified. This can be used to restrict the use of this map data base when used in MultiMapDatabase settings.- Parameters:
minZoom- minimum zoom level supportedmaxZoom- maximum zoom level supported
-
supportsTile
Returns true if MapDatabase contains tile.- Parameters:
tile- tile to be rendered.- Returns:
- true if tile is part of database.
-
wayAsLabelTagFilter
Returns true if a way should be included in the result set for readLabels() By default only ways with names, house numbers or a ref are included in the result set of readLabels(). This is to reduce the set of ways as much as possible to save memory.- Parameters:
tags- the tags associated with the way- Returns:
- true if the way should be included in the result set
-