-
Notifications
You must be signed in to change notification settings - Fork 16
1. Create a new CoordinateReferenceSystem from a reference code
Bocher edited this page Sep 23, 2016
·
1 revision
CTS includes registries that contain the definition of the main Coordinate Reference Systems used in the world. CTS can retrieve these CRS simply by their reference code (for instance : "EPSG:4326" for the Geographic Coordinate System corresponding to WGS84 datum).
This pseudo-code explains how to create a new CoordinateReferenceSystem using this method.
// Create a new CRSFactory, a necessary element to create a CRS without defining one by one all its components
CRSFactory cRSFactory = new CRSFactory();
// Add the appropriate registry to the CRSFactory's registry manager. Here the EPSG registry is used.
RegistryManager registryManager = cRSFactory.getRegistryManager();
registryManager.addRegistry(new EPSGRegistry());
// CTS will read the EPSG registry seeking the 4326 code, when it finds it,
// it will create a CoordinateReferenceSystem using the parameters found in the registry.
CoordinateReferenceSystem crs = cRSFactory.getCRS("EPSG:4326");
The registries used by CTS can be found [here] (https://github.com/orbisgis/CTS/tree/master/src/main/resources/org/cts/registry).