Showing results for 
Search instead for 
Do you mean 

Using an EPSG Code (snippet)

by Technical Evangelist on ‎11-07-2019 12:13 PM - edited on ‎02-24-2020 02:07 AM by Community Manager (352 Views)


Download models


Sometime over the last year or so someone asked me if it would be possible to define the desired Projected Coordinate System (PCS) in Spatial Modeler simply by entering an EPSG code. This was, I think, in connection with a Spatial Model similar to the Geodetic Reproject model. For the output PCS the desire was to enter an EPSG code, such as 32617 to denote that the input imagery should be reprojected to WGS 84 / UTM zone 17N. 


To enter a PCS usually entails popping up the ERDAS IMAGINE Projection Chooser in order to define the desired parameters (which is what the Geodetic Reproject spatial model does). It is possible to enter an EPSG code into this dialog. However the request was to be able to do this without popping up the Projection Chooser because this was a Spatial Model which was going to be published out to a Smart M.App and which would therefore not have access to the the GUI dialog.


At the time I did not think it was possible to just type in a EPSG code string like "32617" and have it used to define the desired projected coordinate system.


However I recently found out that this should be possible using the following basic approach:




The user running the Spatial Model is prompted to enter the EPSG code number (e.g. 32617) via a Port Input. That integer is then converted to a string. The String Input operator is pre-defined with the string "Authority: EPSG; Code: " which is then concatenated with the EPSG code string to form a string such as "Authority: EPSG; Code: 32617". The From String operator is then used to convert this string to a data type of IMAGINE.CoordinateReferenceSystemID, which is the input expected by Operators such as Define Processing Area and Create Affine Transform.


This code snippet could be embedded into the Geodetic Reproject spatial model to replace the pop-up Projection Chooser dialog as shown below:




This modified Spatial Model has also been provided in the download Zip file linked above.

by Technical Evangelist
on ‎09-17-2020 12:07 PM

If you are needing to define a 3D Coordinate system (e.g. EPSG: 32617 for the horizontal component and EPSG: 3855 for the vertical) you'll need to do something like this: