Mapfile class
///////////////////////////////////////////////////////////////////////////
The main class for reading and parsing Mapsforge binary map files (.map).
This class provides low-level access to the map file's contents, including its header, index, and the tile data for ways and points of interest (POIs). It handles the complexities of the binary format, such as variable byte encoding, zoom level intervals, and data block caching.
For performance-critical applications, it is highly recommended to use the IsolateMapfile wrapper, which runs all file operations in a separate isolate to avoid blocking the main UI thread.
The Mapfile instance must be disposed via the dispose() method when it is
no longer needed to release file handles and clear caches.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- preferredLanguage → String?
-
The preferred language to use when extracting labels from the data store.
finalinherited
- readBufferSource ↔ ReadbufferSource
-
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- zoomlevelRange ↔ ZoomlevelRange
-
getter/setter pair
Methods
-
dispose(
) → void - Closes the map file and releases all associated resources.
-
extractLocalized(
String s) → String? -
Extracts a localized name from a multilingual string based on the
preferredLanguage.inherited -
getBoundingBox(
) → Future< BoundingBox> - Returns the geographical bounding box that this map file covers.
-
getMapfileHelper(
) → MapfileHelper - For debugging purposes only
-
getMapFileInfo(
) → MapfileInfo - Returns the low-level header and sub-file information for this map file.
-
getMapHeaderInfo(
) → MapHeaderInfo - Returns the high-level metadata for this map file, such as its bounding box, start position, and available languages.
-
getMapLanguages(
) → List< String> ? - Returns a list of all languages available in this map file.
-
getStartPosition(
) → Future< LatLong?> - Returns the recommended start position for this map file.
-
getStartZoomLevel(
) → Future< int?> - Returns the recommended start zoom level for this map file.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
processBlocks(
ReadbufferSource readBufferSource, QueryParameters queryParameters, SubFileParameter subFileParameter, BoundingBox boundingBox, MapfileSelector selector) → Future< DatastoreBundle> - don't make this method private since we are using it in the example APP to analyze mapfiles
-
readLabels(
Tile upperLeft, Tile lowerRight) → Future< DatastoreBundle> - Reads label data for a rectangular area of tiles.
-
readLabelsSingle(
Tile tile) → Future< DatastoreBundle> -
Reads only label data (POIs and named ways) for a single
tile. -
readMapData(
Tile upperLeft, Tile lowerRight) → Future< DatastoreBundle> - Reads all map data for a rectangular area of tiles.
-
readMapDataSingle(
Tile tile) → Future< DatastoreBundle> -
Reads all map data (ways and POIs) for a single
tile. -
readPoiData(
Tile upperLeft, Tile lowerRight) → Future< DatastoreBundle?> - Reads POI data for a rectangular area of tiles.
-
readPoiDataSingle(
Tile tile) → Future< DatastoreBundle?> -
Reads only Point of Interest (POI) data for a single
tile. -
restrictToZoomRange(
int minZoom, int maxZoom) → void - Restricts the zoom levels for which this datastore will provide data.
-
supportsTile(
Tile tile) → Future< bool> -
Checks if this map file contains data for the given
tile. -
toString(
) → String -
A string representation of this object.
override
-
wayAsLabelTagFilter(
List< Tag> tags) → bool -
A filter to determine if a way should be included in the result set of
readLabels.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
- SIGNATURE_LENGTH_BLOCK → int
-
Length of the debug signature at the beginning of each block.
final
Static Methods
-
createFromContent(
{required Uint8List content, String? preferredLanguage}) → Future< Mapfile> -
Creates a
Mapfileinstance from a byte array in memory. -
createFromFile(
{required String filename, String? preferredLanguage, ReadbufferSource? source}) → Future< Mapfile> -
Creates a
Mapfileinstance from a file path.