User Tools

Site Tools


jrodos:technical_notes:utility:geo_utm

Converting GEO/UTM

To deal with Geo, UTM coordinates JRodos uses JScience library with some extension.


To create Geo coordinates, use LatLong class.

Example

double latitude  = 49.0;
double longitude =  8.0;
LatLong latLong = LatLong.valueOf (latitude, longitude, NonSI.DEGREE_ANGLE);

To create UTM coordinates, use UTM class. You should specify latitude, longitude zone and unit in which northing and easting value are done.

Example

int longitudeZone = 32;
char latitudeZone = 'N';
Unit<Length> exmpUnit = SI.METER;
double eastingValue = 20000;   // aka x, value in unit exmpUnit 
double northingValue = 520000; // aka y, value in unit exmpUnit 
UTM utm = UTM.valueOf (longitudeZone, latitudeZone,
                         eastingValue, northingValue, unit);

To convert UTM to LatLong we suggest to use JScience covertion functions.

Example

// MapConstants.ELLIPSOID is defined as standard WGS84 ellipsoid
LatLong latLong2 = UTM.utmToLatLong(utm, MapConstants.ELLIPSOID); 

To convert LatLong to UTM we suggest to use JRodos covertion functions.

Example

int longitudeZone = MapConstants.LONGITUDE_ZONE;// 33
char latitudeZone = MapConstants.LATITUDE_ZONE; // 'N'
UTM utm2 = RodosUtil.latLongToUtm (latLong, MapConstants.ELLIPSOID,
                                    longitudeZone, latitudeZone);

To convert UTM coordinates from one zone to another it is suggested to convert UTM to GEO coordinates (LatLong) and then convert GEO coordinates to the target UTM zone.


To get latitude, longitude value from instance of LatLong class, easting, northing value from instance of UTM class the following function should be used. The most convenient unit can be used. specified

Example

LatLong latLong;
 
latLong.latitudeValue(NonSI.DEGREE_ANGLE); // get latitude in degrees
latLong.longitudeValue(NonSI.DEGREE_ANGLE);// get longitude in degrees
 
UTM utm;
 
utm.eastingValue(SI.METER); // get easting (x) in meters
utm.northingValue(SI.KILO(SI.METER)); // get northing (y) in kilometers

More information about Units classes can be found in JSR-275 Latest draft specification

Default JRodos UTM zone is 33N. This zone is used as main zone for displaying maps.

jrodos/technical_notes/utility/geo_utm.txt · Last modified: 2015/03/24 15:32 (external edit)