Class TileUtils

java.lang.Object
com.massifmaps.utils.TileUtils

public class TileUtils extends Object
A helper class for mapping coordinates to tiles and back.
  • Method Details

    • calculateMapTile

      public static MapTile calculateMapTile(MapPos mapPos, int zoom, Projection proj)
      Calculates the map tile corresponding to specified point and zoom level.
      Parameters:
      mapPos - Coordinates for the point.
      zoom - Zoom level for the tile.
      proj - The projection to use for tile and point.
      Returns:
      The corresponding map tile.
    • calculateClippedMapTile

      public static MapTile calculateClippedMapTile(MapPos mapPos, int zoom, Projection proj)
      Calculates the map tile corresponding to specified point and zoom level. If the resulting tile is outside the valid range, it will be clipped.
      Parameters:
      mapPos - Coordinates for the point.
      zoom - Zoom level for the tile.
      proj - The projection to use for tile and point.
      Returns:
      The corresponding map tile.
    • calculateMapTileOrigin

      public static MapPos calculateMapTileOrigin(MapTile mapTile, Projection proj)
      Calculates origin coordinates for the given map tile.
      Parameters:
      mapTile - The map tile to use.
      proj - The projection to use for origin.
      Returns:
      The corresponding tile origin.
    • calculateMapTileBounds

      public static MapBounds calculateMapTileBounds(MapTile mapTile, Projection proj)
      Calculates bounds for the given map tile.
      Parameters:
      mapTile - The map tile to use.
      proj - The projection to use for bounds.
      Returns:
      The corresponding tile bounds.