Working with Coordinate Reference Systems
Transform coordinates from one CRS to another
Transform coordinates from one CRS to another
String fromEpsgCode = ...
String toEpsgCode = ...
ICoordinateSystemTransformationService service = ICoordinateSystemTransformationService.Factory.getInstance();
ICoordinateSystemTransformation coordinateTransformation = service.createTransformation(fromEpsgCode, toEpsgCode);
double[] xy1 = coordinateTransformation.coordTrans(10, 20);
Retrieving the name of a CRS
Retrieving the name of a CRS
String epsgCode = ...
ICoordinateSystemChooserService service2 = ICoordinateSystemChooserService.Factory.getInstance();
String name = service2.getCoordinateSystemName(epsgCode);
Opening a CRS Chooser
Opening a CRS Chooser
String defaultEpsgCode = ...
ICoordinateSystemChooserService service2 = ICoordinateSystemChooserService.Factory.getInstance();
ICoordinateSystemChooser chooser = service2.createChooser(defaultEpsgCode, ICRSProvider.LAT_LONG);
chooser.display(new ICoordinateSystemSelectionListener() {
@Override
public void coordinateSystemSelected(String selectedCode) {
DialogManager.getDefault().showMessageDialog(selectedCode + " selected");
}
});
When building your own panel that opens a CRS chooser, consider using the com.interactive.intviewerapi.editors.utils.EpsgCodePanel reusable component instead.
You can plug-in your own chooser using the Coordinate System Chooser Service Extension.