Class BingTileUtil

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ReferencedEnvelope getTileBoundingBox​(double lon, double lat, int zoomLevel)
      Calculates the extent of a tile, given the coordinates and a zoom level
      static int[] lonLatToPixelXY​(double longitude, double latitude, int zoomLevel)
      Converts a point from latitude/longitude WGS-84 coordinates (in degrees) into pixel XY coordinates at a specified level of detail.
      static String lonLatToQuadKey​(double lon, double lat, int zoomLevel)
      Finds the quadkey of a tile for a given pair of coordinates and at a given zoom level.
      static int mapSize​(int zoomLevel)
      Determines the map width and height (in pixels) at a specified level of detail.
      static double[] pixelXYToLonLat​(int pixelX, int pixelY, int zoomLevel)
      Converts a pixel from pixel XY coordinates at a specified level of detail [i.e. zoom level] into latitude/longitude WGS-84 coordinates (in degrees).
      static int[] pixelXYToTileXY​(int pixelX, int pixelY)
      Converts pixel XY coordinates into tile XY coordinates of the tile containing the specified pixel.
      static String tileXYToQuadKey​(int tileX, int tileY, int zoomLevel)
      Converts tile XY coordinates into a QuadKey at a specified level of detail.
    • Method Detail

      • lonLatToPixelXY

        public static int[] lonLatToPixelXY​(double longitude,
                                            double latitude,
                                            int zoomLevel)
        Converts a point from latitude/longitude WGS-84 coordinates (in degrees) into pixel XY coordinates at a specified level of detail.

        The Term "Level of detail" is a synonym for zoom level.

        Parameters:
        longitude - Longitude of the point, in degrees.
        latitude - Latitude of the point, in degrees.
        zoomLevel - The zoom level or "Level of detail", from 1 (lowest detail) to 23 (highest detail).
      • pixelXYToLonLat

        public static double[] pixelXYToLonLat​(int pixelX,
                                               int pixelY,
                                               int zoomLevel)
        Converts a pixel from pixel XY coordinates at a specified level of detail [i.e. zoom level] into latitude/longitude WGS-84 coordinates (in degrees).

        Note that the X and Y coordinates of a "virtual image" that contains all tiles of a given level. They are not the coordinates of a given column or row.

        Parameters:
        pixelX - X coordinate of the point, in pixels.
        pixelY - Y coordinates of the point, in pixels.
        zoomLevel - zoom level or "Level of detail", from 1 (lowest detail) to 23 (highest detail)
      • mapSize

        public static int mapSize​(int zoomLevel)
        Determines the map width and height (in pixels) at a specified level of detail.
        Parameters:
        zoomLevel - Zoom level or "Level of detail", from 1 (lowest detail) to 23 (highest detail)
        Returns:
        the map size
      • pixelXYToTileXY

        public static int[] pixelXYToTileXY​(int pixelX,
                                            int pixelY)
        Converts pixel XY coordinates into tile XY coordinates of the tile containing the specified pixel.
        Parameters:
        pixelX - Pixel X coordinate.
        pixelY - Pixel Y coordinate.
      • tileXYToQuadKey

        public static String tileXYToQuadKey​(int tileX,
                                             int tileY,
                                             int zoomLevel)
        Converts tile XY coordinates into a QuadKey at a specified level of detail.
        Parameters:
        tileX - Tile X coordinate.
        tileY - Tile Y coordinate.
        zoomLevel - Zoom level or "Level of detail", from 1 (lowest detail) to 23 (highest detail)
        Returns:
        A string containing the QuadKey.
      • lonLatToQuadKey

        public static String lonLatToQuadKey​(double lon,
                                             double lat,
                                             int zoomLevel)
        Finds the quadkey of a tile for a given pair of coordinates and at a given zoom level.
        Parameters:
        lon - The longitude
        lat - The latitude
        zoomLevel - The zoom level
        Returns:
        A string denoting the quadkey of the tile.
      • getTileBoundingBox

        public static ReferencedEnvelope getTileBoundingBox​(double lon,
                                                            double lat,
                                                            int zoomLevel)
        Calculates the extent of a tile, given the coordinates and a zoom level
        Parameters:
        lon - The longitude
        lat - The latitude
        Returns:
        A string denoting the quadkey of the tile.