org.jscience.geography.coordinates

Package org.jscience.geography.coordinates

Provides linear or angular quantities which designate the position that a point occupies in a given reference frame or system.

See: Description

Package org.jscience.geography.coordinates Description

Provides linear or angular quantities which designate the position that a point occupies in a given reference frame or system.

Coordinates are unambigous only when the coordinates reference system to which those coordinates are related has been fully defined.

Applications may create new types of coordinates either by extending Coordinates (in which case they must provide a coordinates reference system) or simply by combining existing coordinates together. For example:

        // High-Precision Coordinates.    class Position3D extends Coordinates<GeocentricCRS> {         public static final GeocentricCRS<Position3D> CRS = ...;                          public GeocentricCRS<Position3D> getCoordinateReferenceSystem {             return CRS; // All instances use the same reference system.         }         public Real getX(Unit<Length> u) { ... }         public Real getY(Unit<Length> u) { ... }         public Real getZ(Unit<Length> u) { ... }         ...    }        // Combining existing coordinates.    class LatLongHeight extends CompoundCoordinates<LatLong, Height> { }    class HeightTime extends CompoundCoordinates<Height, Time> { }    class UtmHeightTime extends CompoundCoordinates<CompoundCoordinates<UTM, Height>, Time> { }    

Conversion between coordinates is achieved through their coordinates reference system. For example:

    // Converts UTM coordinates to Latitude/Longitude.    UTM utm = UTM.valueOf(17, 'E', 444.5, 556.44, METRE);    CoordinatesConverter<UTM, LatLong> utmToLatLong = UTM.CRS.getConverterTo(LatLong.CRS);    LatLong latLong = utmToLatLong.convert(utm);        // Converts compound coordinates to X/Y/Z geocentric coordinates.    CompoundCoordinates<UTM, Height> utmHeight = new CompoundCoordinates(utm, new Height(2330.55, FOOT));    XYZ xyz = new CompoundCRS<UTM, Height>(UTM.CRS, Height.CRS).getConverterTo(XYZ.CRS).convert(utmHeight);    // Converts any projected coordinates to Latitude/Longitude.    Coordinates<ProjectedCRS> coord2d;    LatLong latLong = coord2d.getCoordinateReferenceSystem().getConverterTo(LatLong.CRS).convert(coord2d);    

SCaVis 2.0 © jWork.ORG