类 GeoUtil


  • public final class GeoUtil
    extends Object
    These are math utilities for converting between pixels, tiles, and geographic coordinates. Implements a Google Maps style mercator projection.
    作者:
    joshy
    • 构造器详细资料

      • GeoUtil

        public GeoUtil()
    • 方法详细资料

      • getMapSize

        public static Dimension getMapSize​(int zoom,
                                           TileFactoryInfo info)
        参数:
        zoom - Zoom
        info - Tile factory info
        返回:
        the size of the map at the given zoom, in tiles (num tiles tall by num tiles wide)
      • isValidTile

        public static boolean isValidTile​(int x,
                                          int y,
                                          int zoomLevel,
                                          TileFactoryInfo info)
        参数:
        x - X
        y - Y
        zoomLevel - Zoom level
        info - Tile factory info
        返回:
        true if this point in tiles is valid at this zoom level. For example, if the zoom level is 0 (zoomed all the way out, where there is only one tile), then x,y must be 0,0
      • getBitmapCoordinate

        public static Point2D getBitmapCoordinate​(GeoPosition c,
                                                  int zoomLevel,
                                                  TileFactoryInfo info)
        Given a position (latitude/longitude pair) and a zoom level, return the appropriate point in pixels. The zoom level is necessary because pixel coordinates are in terms of the zoom level
        参数:
        c - A lat/lon pair
        zoomLevel - the zoom level to extract the pixel coordinate for
        info - Tile factory info
        返回:
        Bitmap coordinate point
      • getBitmapCoordinate

        public static Point2D getBitmapCoordinate​(double latitude,
                                                  double longitude,
                                                  int zoomLevel,
                                                  TileFactoryInfo info)
        Given a position (latitude/longitude pair) and a zoom level, return the appropriate point in pixels. The zoom level is necessary because pixel coordinates are in terms of the zoom level
        参数:
        latitude - Latitude
        longitude - Longitude
        zoomLevel - the zoom level to extract the pixel coordinate for
        info - Tile factory info
        返回:
        Position point
      • getPositionForAddress

        public static GeoPosition getPositionForAddress​(String street,
                                                        String city,
                                                        String state)
                                                 throws IOException
        Convert a street address into a position. Uses the Yahoo GeoCoder. You must supply your own yahoo id.
        参数:
        street - Street
        city - City
        state - State (must be a US state)
        返回:
        the position of this street address
        抛出:
        IOException - if the request fails.
      • getResolution

        public static double getResolution​(int zoomLevel,
                                           double lat)
        Get resolution
        参数:
        zoomLevel - The zoom level
        lat - The latitude
        返回:
        Resolution
      • getScale

        public static double getScale​(int zoomLevel,
                                      double lat)
        Get scale
        参数:
        zoomLevel - The zoom level
        lat - The latitude
        返回:
        Scale