MapFile class

A class for reading binary map files.

The readMapData method is now thread safe, but care should be taken that not too much data is read at the same time (keep simultaneous requests to minimum)

@see Specification

Inheritance

Constructors

MapFile(String filename, int timestamp, String language)
Opens the given map file channel, reads its header data and validates them. [...]
MapFile.empty()
Only used for tests

Properties

boundingBox BoundingBox
Opens the given map file, reads its header data and validates them. [...]
read-only, override
filename String
final
hashCode int
The hash code for this object. [...]
read-only, inherited
preferredLanguage String
the preferred language when extracting labels from this data store. The actual implementation is up to the concrete implementation, which can also simply ignore this setting.
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
startPosition LatLong
Gets the initial map position. [...]
read-only, override
startZoomLevel int
Gets the initial zoom level. [...]
read-only, override
timestamp int
final
zoomLevelMax int
read / write
zoomLevelMin int
read / write

Methods

close() → void
Closes the map database.
override
closeFileChannel() → void
Closes the map file channel and destroys all internal caches. Has no effect if no map file channel is currently opened.
dispose() → void
extractLocalized(String s) String
Extracts substring of preferred language from multilingual string using the preferredLanguage setting.
inherited
getDataTimestamp(Tile tile) int
Returns the creation timestamp of the map file. [...]
override
getMapFileHeader() → MapFileHeader
@return the header data for the current map file.
getMapFileInfo() → MapFileInfo
@return the metadata for the current map file.
getMapLanguages() List<String>
@return the map file supported languages (may be null).
init() Future<void>
Initializes the datastore
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
processBlocks(ReadBufferMaster readBufferMaster, QueryParameters queryParameters, SubFileParameter subFileParameter, BoundingBox boundingBox, Selector selector) Future<DatastoreReadResult>
processPOIs(double tileLatitude, double tileLongitude, int numberOfPois, BoundingBox boundingBox, bool filterRequired, ReadBuffer readBuffer) List<PointOfInterest>
readLabels(Tile upperLeft, Tile lowerRight) Future<DatastoreReadResult>
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 [...]
override
readLabelsSingle(Tile tile) Future<DatastoreReadResult>
Reads only labels for tile. [...]
override
readMapData(Tile upperLeft, Tile lowerRight) Future<DatastoreReadResult>
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 [...]
override
readMapDataSingle(Tile tile) Future<DatastoreReadResult>
Reads all map data for the area covered by the given tile at the tile zoom level. [...]
override
readPoiData(Tile upperLeft, Tile lowerRight) Future<DatastoreReadResult>
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. [...]
override
readPoiDataSingle(Tile tile) Future<DatastoreReadResult>
Reads only POI data for tile. [...]
override
restrictToZoomRange(int minZoom, int maxZoom) → void
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. [...]
supportsTile(Tile tile) bool
Returns true if MapDatabase contains the given tile. [...]
override
toString() String
A string representation of this object. [...]
inherited
wayAsLabelTagFilter(List<Tag> tags) bool
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. @param tags the tags associated with the way @return true if the way should be included in the result set
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Static Properties

BITMASK_INDEX_OFFSET int
Bitmask to extract the block offset from an index entry.
final
BITMASK_INDEX_WATER int
Bitmask to extract the water information from an index entry.
final
complete bool
for debugging purposes
final
DEFAULT_START_ZOOM_LEVEL int
Default start zoom level.
final
INDEX_CACHE_SIZE int
Amount of cache blocks that the index cache should store.
final
INVALID_FIRST_WAY_OFFSET String
Error message for an invalid first way offset.
final
POI_FEATURE_ELEVATION int
Bitmask for the optional POI feature "elevation".
final
POI_FEATURE_HOUSE_NUMBER int
Bitmask for the optional POI feature "house number".
final
POI_FEATURE_NAME int
Bitmask for the optional POI feature "name".
final
POI_LAYER_BITMASK int
Bitmask for the POI layer.
final
POI_LAYER_SHIFT int
Bit shift for calculating the POI layer.
final
POI_NUMBER_OF_TAGS_BITMASK int
Bitmask for the number of POI tags.
final
SIGNATURE_LENGTH_BLOCK int
Length of the debug signature at the beginning of each block.
final
SIGNATURE_LENGTH_POI int
Length of the debug signature at the beginning of each POI.
final
SIGNATURE_LENGTH_WAY int
Length of the debug signature at the beginning of each way.
final
TAG_KEY_ELE String
The key of the elevation OpenStreetMap tag.
final
TAG_KEY_HOUSE_NUMBER String
The key of the house number OpenStreetMap tag.
final
TAG_KEY_NAME String
The key of the name OpenStreetMap tag.
final
TAG_KEY_REF String
The key of the reference OpenStreetMap tag.
final
WAY_FEATURE_DATA_BLOCKS_BYTE int
Bitmask for the optional way data blocks byte.
final
WAY_FEATURE_DOUBLE_DELTA_ENCODING int
Bitmask for the optional way double delta encoding.
final
WAY_FEATURE_HOUSE_NUMBER int
Bitmask for the optional way feature "house number".
final
WAY_FEATURE_LABEL_POSITION int
Bitmask for the optional way feature "label position".
final
WAY_FEATURE_NAME int
Bitmask for the optional way feature "name".
final
WAY_FEATURE_REF int
Bitmask for the optional way feature "reference".
final
WAY_LAYER_BITMASK int
Bitmask for the way layer.
final
WAY_LAYER_SHIFT int
Bit shift for calculating the way layer.
final
WAY_NUMBER_OF_TAGS_BITMASK int
Bitmask for the number of way tags.
final
wayFilterDistance int
read / write
wayFilterEnabled bool
Way 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.
read / write