Coordinate Reference Systems (CRS)

Overview

This page describes about how to manage coordinate reference system (CRS) information within OPALS and description of python script to help some tasks.

How CRS is managed within OPALS

CRS in ODM files is stored as WKT (Well-known text) String. While OPALS deals with other data format, each file stores (maybe partial) CRS information by themselves. In case of grid datasets which are usually handled using GDAL, CRS information is stored separately in the metadata in addition to the driver supported CRS storage mechanism which are either format-supported or GDAL auxillary file. This is because some GDAL drivers (e.g. GeoTIFF) might be lossy as unrecognized items (e.g. EXTENSION) might not be stored. CRS in GDAL raster files are stored using SOURCE_CRS key in the metadata. If this CRS metadata available then this information will be used as CRS instead of CRS from GDAL.

Displaying CRS

Module Info can be used to show information from an ODM file. Additionally, displaying CRS information from ODM and grid data files (supported by GDAL) is available through Python helper script (see here ).

CRS from input files

using Module Import, CRS information is obtained using the following order :

  • stored within the file or in external .prj file
  • coord_ref_sys parameter

CRS in the output files

Output files generated from OPALS modules carries CRS information from its input file(s). If there are some input file that do not have CRS information stored then it is assumed that the CRS is the same as other file(s) has CRS information stored. In case where all the input files have no CRS information stored, CRS information can be manually set during modules executions via coord_ref_sys parameter. Moreover, CRS information can also be set globally in the installation-wise configuration file.

Comparing CRS

The following definitions are used when comparing CRS information.

Empty CRS

A CRS is considered empty if it is an empty string.

Equal CRS
Two CRSs are considered equal if these conditions are satisfied:
  • Both CRS are of the same type (the root node are COMPD_CS and COMPD_CS, GEOG_CS and GEOG_CS, etc.)
  • Both share the same parameters (for GEOG_CS: DATUM, PRIMEM, UNIT)

Validating CRS

Python helper scripts

a python script (_setCRS.py) is provided in the $OPALS_ROOT/opals/workflows directory to show or modify existing files. Another python script (_validateCRS.py) is also provided for validating CRS information given from text file containing CRS in WKT, from ODM file, or from GDAL-supported rasters.

Parameters

-i/–inFileinput file
Type: str
Remarks: mandatory
name of ODM or raster file in GDAL supported format
-e/–epsgCodeEPSG code
Type: int
Remarks: optional
EPSG code representing CRS information
-w/–wktWKT file
Type: str
Remarks: optional
filename containing CRS spec in WKT format
-c/–copySourcesource file
Type: str
Remarks: optional
filename (ODM or raster) containing CRS spec in WKT format
-r/–reset
Type: flag
Remarks: optional
remove all CRS contents from input file

Printing CRS information from a file

_setCRS.py script can be use to print out available CRS information from a ODM or raster file.

opals _setCRS.py -i albis.tif

Above command will result in the following output

CRS Location CRS Content
GDAL Driver LOCAL_CS["X-Y-Z",UNIT["metre",1,AUTHORITY["EPSG","9001"]]]

Adding CRS information to a file

To add CRS information from EPSG code, Use -e/--epsgCode parameter

opals _setCRS.py -i albis.tif -e 21781

To add CRS information from .prj file containing WKT string, Use -w/--wkt parameter

opals _setCRS.py -i albis.tif -w CH1903_LV03.prj

To add CRS information from a source file (ODM or GDAL Rasters) containing WKT string, Use -c/--copySource parameter

opalsImport -inFile albis.laz
opals _setCRS.py -i albis.tif -c albis.odm

Validating CRS information from a file

To add CRS information from file containing WKT string, Use -w/--wkt parameter

opals _validateCRS.py -w CH1903_LV03.prj

To add CRS information from a source file (ODM or GDAL Rasters) containing WKT string, Use -i/--inFile parameter

opalsImport -inFile albis.laz
opals _validateCRS.py -inFile albis.odm

References

  • Geographic information - Well-known text (WKT) representation of coordinate reference systems OGC 12-063r5

Author
paryan, gm
Date
29.05.2020
opalsImport is the executable file of Module Import
Definition: ModuleExecutables.hpp:113
Contains the public interface of OPALS.
Definition: AbsValueOrQuantile.hpp:8
@ c
focal length (opalsStripAdjust)