Using external coordinate system names with CoordinateSystemDescriptionConverter

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2020.2

Introduction

This article will go through how to use the CoordinateSystemDescriptionConverter to convert coordinate system strings between different representations.

This transformer can be used to convert to or from an FME coordinate system name and:

  • Autodesk WKT (Well-Known Text)
  • EPSG number
  • Esri WKT (Well-Known Text)
  • Esri WKID (Well-Known ID)
  • MapInfo string
  • OGC WKT (Well-Known Text)
  • Oracle SRID (Spatial Reference ID)
  • PROJ.4 string


It can be used in conjunction with the CoordinateSystemExtractor and CoordinateSystemSetter to leverage externally defined coordinate systems in an FME workflow. This helps FME recognize coordinate system definitions that are not currently referenced within FME.

Note this simply converts the coordinate system name and does NOT reproject or change your data. If you are looking to reproject, use the Reprojector or see Reprojection and Spatial Overlay with FME.
 

Step-by-Step Instructions

In this example, we have a simple .txt file containing the following Esri WKT coordinate system definition:
 

PROJCS["PCS_Lambert_Conformal_Conic",
GEOGCS["GCS_North_American_1983",
DATUM["D_North_American_1983",
SPHEROID["GRS_1980",6378137.0,298.257222101]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]],
PROJECTION["Lambert_Conformal_Conic"],
PARAMETER["False_Easting",6200000.0],
PARAMETER["False_Northing",3000000.0],
PARAMETER["Central_Meridian",-91.86666666666666],
PARAMETER["Standard_Parallel_1",49.0],
PARAMETER["Standard_Parallel_2",77.0],
PARAMETER["Latitude_Of_Origin",63.390675],
UNIT["Meter",1.0]]


Our goal is to build an FME Workspace and use the CoordinateSystemDescriptionConverter to find out what coordinate system this definition represents and set that coordinate system on the output data.

The source .txt file and a completed workspace template are in the attachment, CoordinateSystemDescriptionConverterTutorial.zip.

1. Read in the source data
Click “Add Reader” and add a Text File Reader that points to the source .txt file. Set it to read the whole file at once instead of line-by-line.

  • Format: Text File
  • Dataset: <Tutorial Download>\my_coordinate_system_definition.txt
  • Parameters > Read Whole File At Once: Yes




This Reader will read in the coordinate system definition in the attribute “text_line_data”.

In this scenario, the definition is contained in a .txt file, but when you are working with other data types, the definition might be contained in a PRJ file or a different attribute.

2. Add a CoordinateSystemDescriptionConverter
Click anywhere on the canvas and begin typing “CoordinateSystemDescriptionConverter”. Add this transformer to the workspace and connect it to the Reader Feature Type.



Double-click the transformer to open the parameters. Configure it as follows:



This will take the definition in the “text_line_data” attribute, convert it from Esri WKT to the internal FME representation, and store the resulting description in the new “coord_sys” attribute.

3. Add a CoordinateSystemSetter
Click anywhere on the canvas and begin typing “CoordinateSystemSetter”. Add this transformer to the workspace after the CoordinateSystemDescriptionConverter.



Double-click the transformer to open the parameters. Set the “Coordinate System” parameter to the attribute “coord_sys”.



As data flows through this workspace, this will set its coordinate system to the definition contained in the “coord_sys” attribute.

4. Connect an Inspector and run the workspace
Right-click the output port and choose “Connect Inspector”, which will direct the output to the FME Data Inspector. The final workspace looks like this:



Click “Run”.

5. Inspect the output
In the Visual Preview pane, you’ll see the output as text attributes. The column “coord_sys” contains the name:

_NAD83.CanLam.5_0

This is the name of the input coordinate system definition.



The workspace has successfully identified the coordinate system from the input definition in the text file, converted it from Esri WKT to the FME internal representation, and set that coordinate system on the data passing through the workflow.
 

Troubleshooting

Sometimes, FME’s Coordinate System Gallery doesn't include the coordinate system you need to use. In these cases, you have to define the coordinate system before FME can use it. If FME doesn't recognize your coordinate system, you can add a custom coordinate system by following the steps outlined in "About Custom Coordinate Systems".

 

Additional Resources

CoordinateSystemDescriptionConverter Documentation: learn more about parameters and see further examples in the FME documentation about this transformer.

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.