Class MapDatabase

java.lang.Object
org.oscim.tiling.source.mapfile.MapDatabase
All Implemented Interfaces:
ITileDataSource

public class MapDatabase extends Object implements ITileDataSource
A class for reading binary map files.
See Also:
  • Field Details

    • wayFilterEnabled

      public static boolean wayFilterEnabled
      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.
    • wayFilterDistance

      public static int wayFilterDistance
    • SIMPLIFICATION_MIN_ZOOM

      public static int SIMPLIFICATION_MIN_ZOOM
      Reduce points on-the-fly while reading from map files.
    • SIMPLIFICATION_MAX_ZOOM

      public static int SIMPLIFICATION_MAX_ZOOM
  • Constructor Details

  • Method Details

    • getTileSource

      public MapFileTileSource getTileSource()
    • query

      public void query(MapTile tile, ITileDataSink sink)
      Specified by:
      query in interface ITileDataSource
      Parameters:
      tile - the tile to load.
      sink - the callback to handle the extracted map elements.
    • dispose

      public void dispose()
      Description copied from interface: ITileDataSource
      Implementations should cancel and release all resources
      Specified by:
      dispose in interface ITileDataSource
    • cancel

      public void cancel()
      Description copied from interface: ITileDataSource
      Implementations should cancel their IO work and return
      Specified by:
      cancel in interface ITileDataSource
    • readLabels

      public MapReadResult readLabels(Tile tile)
      Reads only labels for tile.
      Parameters:
      tile - tile for which data is requested.
      Returns:
      label data for the tile.
    • readLabels

      public MapReadResult 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. 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

      public MapReadResult readMapData(Tile tile)
      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

      public MapReadResult 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. 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

      public MapReadResult readPoiData(Tile tile)
      Reads only POI data for tile.
      Parameters:
      tile - tile for which data is requested.
      Returns:
      POI data for the tile.
    • readPoiData

      public MapReadResult 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. 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 supported
      maxZoom - maximum zoom level supported
    • supportsTile

      public boolean supportsTile(Tile tile)
      Returns true if MapDatabase contains tile.
      Parameters:
      tile - tile to be rendered.
      Returns:
      true if tile is part of database.
    • wayAsLabelTagFilter

      public boolean wayAsLabelTagFilter(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(). 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