Retrieving WGS84 coordinates from an USRP map

Article ID: 2458
Last updated: 29 May, 2018
Article ID: 2458
Last updated: 29 May, 2018
Revision: 3
Views: 733
Posted: 23 Jan, 2014
by Dean J.
Updated: 29 May, 2018
by Gargani A.

Question

How to retrieve WGS84 coordinates from an USRP map?

Answer

One of the differences between USRP and ASRP is that USRP uses UTM projection.

If you want to transform an USRP map from UTM to WGS84 coordinates, you need to use an IlvProjectionTransform which will allow you to transform projected cartographic coordinates to and from ellipsoidal coordinates systems.

The sample code below illustrates how to retrieve WGS84 coordinates from an USRP map loaded by an IlvRasterUSRPReader.

Note: the code below can be inserted in USRPLoadAction, makeReader(String) method of the mapbuilderextension sample provided with JViews Maps distribution.

IlvRasterAbstractReader reader = (IlvRasterAbstractReader) USRPDefLess.newIlvRasterUSRPReader();
USRPDefLess.addMap(reader, fileName);
// USRP file uses UTM projection
IlvProjectionTransform projection = (IlvProjectionTransform)reader.getInternalTransformation(0);

IlvCoordinate lr = reader.getLowerRightCorner();
IlvCoordinate uf = reader.getUpperLeftCorner();
System.out.print("UTM Coordinates:\n");
System.out.println("lr :: " + lr);
System.out.println("uf :: " + uf);
try {
  projection.getInverse().transform(lr, lr);
  projection.getInverse().transform(uf, uf);

  System.out.print("WGS84 in radian:\n");
  System.out.println("lr :: " + lr);
  System.out.println("uf :: " + uf);
} catch (IlvCoordinateTransformationException e) {
   e.printStackTrace();
}

// Convert radian to degrees:
lr.x *= (180/Math.PI);
lr.y *= (180/Math.PI);
uf.x *= (180/Math.PI);
uf.y *= (180/Math.PI);

System.out.print("WGS84 in degrees:\n");
System.out.println("lr :: " + lr);
System.out.println("uf :: " + uf);

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2458
Last updated: 29 May, 2018
Revision: 3
Views: 733
Posted: 23 Jan, 2014 by Dean J.
Updated: 29 May, 2018 by Gargani A.
Also listed in


Others in this category