Coordinate Reference System Identifiers

Question

How do I determine the EPSG Code or WKT for the Coordinate Reference System Identifier of an incoming Raster, Feature, or PointCloud data stream in my operator?

Answer

The great thing about coordinate reference system (CRS) identifier standards is that there are so many to choose from :-(

The Spatial Modeler supports an IMAGINE.CoordinateReferenceSystemID data type meant to be able to hold an identier for a CRS no matter its source. The data type holds the designation of the authority for the identification system as well as the specific authority-based identifier for the CRS at hand, referred to as the code.

The Spatial Modeler currently supports four authorities, though more can be added in the future:

EPRJ

IMAGINE's coding system based on .plb content

EPSG

A coded system defined by the International Association of Oil & Gas Producers

GeoKey Moniker

A coded system compatible with GeoTIFF GeoKeys

PRJ

ESRI-style WKT

The Spatial Modeler attempts to retain the native form of the CRS identifier throughout a model's execution. If you are building an operator and need to get at the CRS identifier in a specific form, however, you can use the Construct CRS ID operator internally to translate from one authority to another (if such a translation is possible). The source code for this would look something like the following:

// Get the CRS ID from the data stream// Below we illustrate obtaining the CRS from an incoming Raster// data stream. Similar actions for Feature, PointCloud would look// like//// Feature: featureInputPort->GetDataPtr<FeatureInfoData>()->GetCoordinateReferenceSystemID()// PointCloud: pointCloudInputPort->GetDataPtr<PointCloudInfoData>()->GetCoordinateReferenceSystemId()CoordinateReferenceSystemIDPtr crsID(new CoordinateReferenceSystemID(rasterInputPort->GetDataPtr<RasterInfoData>()->GetMapBoundary()->GetCRS()));

// Use the crsid operator to translate the authorityOperatorPtr crsidOp(OperatorFactory::Create(L"IMAGINE", L"ConstructCRSID"));crsidOp->GetPort(L"HorizontalCRS")->SetDataPtr<CoordinateReferenceSystemIDData>(crsID);crsidOp->GetPort(L"Authority")->SetDataValue<StringData>(L"EPSG");CoordinateReferenceSystemIDPtr xlatedCrsId;try{ xlatedCrsId = crsidOp->GetPort(L"CRS")->GetDataPtr<CoordinateReferenceSystemIDData>();}catch (...){ // Unfortunately the v16.00 behavior of the operator is that if you // supply an authority and the CRS ID cannot be translated to that // authority it is treated as an exception // This will be remedied in a future release}if (xlatedCrsId){ std::wstring EPSGCode(xlatedCrsId->GetCode()); std::wcout << L"EPSG Code is " << EPSGCode;}