类 GeoUtil
- java.lang.Object
-
- org.meteoinfo.data.mapdata.webmap.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()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static Point2DgetBitmapCoordinate(double latitude, double longitude, int zoomLevel, TileFactoryInfo info)Given a position (latitude/longitude pair) and a zoom level, return the appropriate point in pixels.static Point2DgetBitmapCoordinate(GeoPosition c, int zoomLevel, TileFactoryInfo info)Given a position (latitude/longitude pair) and a zoom level, return the appropriate point in pixels.static DimensiongetMapSize(int zoom, TileFactoryInfo info)static GeoPositiongetPosition(Point2D pixelCoordinate, int zoom, TileFactoryInfo info)static GeoPositiongetPositionForAddress(String[] fields)static GeoPositiongetPositionForAddress(String street, String city, String state)Convert a street address into a position.static doublegetResolution(int zoomLevel, double lat)Get resolutionstatic doublegetScale(int zoomLevel, double lat)Get scalestatic booleanisValidTile(int x, int y, int zoomLevel, TileFactoryInfo info)
-
-
-
方法详细资料
-
getMapSize
public static Dimension getMapSize(int zoom, TileFactoryInfo info)
- 参数:
zoom- Zoominfo- 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- Xy- YzoomLevel- Zoom levelinfo- 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 pairzoomLevel- the zoom level to extract the pixel coordinate forinfo- 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- Latitudelongitude- LongitudezoomLevel- the zoom level to extract the pixel coordinate forinfo- Tile factory info- 返回:
- Position point
-
getPosition
public static GeoPosition getPosition(Point2D pixelCoordinate, int zoom, TileFactoryInfo info)
-
getPositionForAddress
public static GeoPosition getPositionForAddress(String[] fields) throws IOException
- 抛出:
IOException
-
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- Streetcity- Citystate- 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 levellat- The latitude- 返回:
- Resolution
-
getScale
public static double getScale(int zoomLevel, double lat)Get scale- 参数:
zoomLevel- The zoom levellat- The latitude- 返回:
- Scale
-
-