fmeobjects.FMECoordSysManager

Inheritance diagram of fmeobjects.FMECoordSysManager

FMECoordSysManager.defineCoordSys

defineCoordSys(coordSysParms),

FMECoordSysManager.defineCoordSysFromFeature

defineCoordSysFromFeature(coordSysFeature),

FMECoordSysManager.defineCoordSysFromOGCDef(...)

Defines a coord system based on the OGC definition passed in.

FMECoordSysManager.defineDatum(datumName, ...)

Defines a datum based on the parameters passed in.

FMECoordSysManager.defineEllipsoid(...)

Defines an ellipsoid based on the parameters passed in.

FMECoordSysManager.defineUnit(unitName, ...)

Defines a unit based on the parameters passed in.

FMECoordSysManager.getCoordSysAsOGCDef(...)

Gets the OGC definition of the coordinate system whose name is passed in.

FMECoordSysManager.getCoordSysList()

Retrieves the list of all supported coordinate system names.

FMECoordSysManager.getCoordSysNameFromPrjFile

getCoordSysNameFromPrjFile(prjFileName),

FMECoordSysManager.getCoordSysParms

getCoordSysParms(coordSysName),

FMECoordSysManager.getCoordSysParmsAsFeature

getCoordSysParmsAsFeature(coordSysName),

FMECoordSysManager.getDatumParms

getDatumParms(datumName),

FMECoordSysManager.getEllipsoidParms

getEllipsoidParms(ellipsoidName),

FMECoordSysManager.getUnitParms

getUnitParms(unitName),

FMECoordSysManager.getUserCoordSysDefFiles()

Returns a list of all the files that coordinate system defs should be read from.

FMECoordSysManager.readDefsFromFile

readDefsFromFile(fileName),

FMECoordSysManager.reprojectDirectory()

Return the directory where the reprojection subsystem support files live.

FMECoordSysManager.writePrjFile(prjFileName, ...)

Writes a .prj file containing the ESRI Well Known Text representation of the coord system name passed in .

class FMECoordSysManager

FME Coordinate System Manager Class

init()

This class provides the ability to retrieve and define coordinate system information: projections, datums, ellipsoids, and units.

__init__(*args, **kwargs)
defineCoordSys()

defineCoordSys(coordSysParms),

Provides a name for a coordinate system defined by the parameters passed in. A new coordinate system is defined only if the coordinate system did not already exist under a previous name.

Parameters:

coordSysParms (list[str] or dict[str, str]) – A pairwise array of FME Coordinate system parameters, and their values. (i.e. entry 0 is a FME coordinate system parameter keyword, as defined in the coordinate systems section of the FME Reference Manual, and entry 1 is its value. Entry 2 is the parameter name, entry 3 is its value, and so on.) There MUST be an even number of parameters in the ‘coordSysParms’ array.

Return type:

str

Returns:

A name that is unique to the coordinate system.

Raises:

FMEException – An FMEException is raised if there was an error.

defineCoordSysFromFeature()

defineCoordSysFromFeature(coordSysFeature),

Defines the coordinate system from the passed in feature.

Parameters:

coordSysFeature (FMEFeature) – The FMEFeature the coordinate system is defined by.

Return type:

None

Raises:

FMEException – An FMEException is raised if there was an error.

defineCoordSysFromOGCDef(ogcDef, coordSysName)

Defines a coord system based on the OGC definition passed in.

Parameters:
  • ogcDef (str) – The OGC definition the coordinate system is defined from.

  • coordSysName (str) –

    The coordSysName is a parameter that takes in the following hint constants that define the form of the OGC definition.

    • ESRI: Translate ESRI style to standard first, before getting a FME name,

    • AUTODESK: Use the autodesk WKT exceptions file first before trying automated WKT conversion,

    • EPSG: Translate an EPSG code to FME (needs some support files to operate),

    • MAPINFO: Convert a MapInfo coordinate system string (held in the ogcDef string) to a FME name,

    • PROJ4: Translate a PROJ.4 string to FME,

    • ORACLE: Use the Oracle SRID to FME name exceptions file (an SRID code is excepted in the ogcDef parameter.

Return type:

str

Returns:

The name of the coordinate system that can be used within FME. If the source representation does not have a FME representation (but no errors occur) the return value will be an empty string. This could occur, for example, when no mapping exists between an Oracle SRID and a FME coordinate system.

Raises:

FMEException – An FMEException is raised if there was an error.

defineDatum(datumName, datumParams)

Defines a datum based on the parameters passed in. The datum definition is only validated on first use. If the datum was already defined, the new definition replaces the old one and no error is returned. To find out if the datum already existed, the getDatumParms call below can be used.

Parameters:
  • datumName (str) – The name that the datum can be referred to by later in coordinate system definitions.

  • datumParams (list[str] or dict[str, str]) – A list of pairwise datum definition parameters, and their values. (i.e. entry 0 is a datum definition keyword, as defined in the coordinate systems section of the FME Reference Manual section 8.6.1, and entry 1 is its value. Entry 2 is the parameter name, entry 3 is its value, and so on.) There MUST be an even number of parameters.

Return type:

None

Raises:

FMEException – An FMEException is raised if there was an error.

defineEllipsoid(ellipsoidName, ellipsoidParams)

Defines an ellipsoid based on the parameters passed in. The ellipsoid definition is only validated on first use. If the ellipsoid was already defined, the new definition replaces the old one and no error is returned. To find out if the ellipsoid already existed, the getEllipsoidParms call below can be used.

Parameters:
  • ellipsoidName (str) – The name that the ellipsoid can be referred to by later in coordinate system definitions.

  • ellipsoidParams (list[str] or dict[str, str]) – A pairwise list of ellipsoid definition parameters, and their values. (i.e. entry 0 is an ellipsoid definition keyword, as defined in the coordinate systems section of the FME Reference Manual section 8.7.1, and entry 1 is its value. and entry 1 is its value. Entry 2 is the parameter name, entry 3 is its value, and so on.) There MUST be an even number of parameters.

Return type:

None

Raises:

FMEException – An FMEException is raised if there was an error.

defineUnit(unitName, unitParams)

Defines a unit based on the parameters passed in. The unit definition is only validated on first use. If the unit was already defined, the new definition replaces the old one and no error is returned. To find out if the unit already existed, the getUnitParms call below can be used.

Parameters:
  • unitName (str) – The name that the unit can be referred to by later in coordinate system definitions.

  • unitParams (list[str] or dict[str, str]) – A pairwise list of unit definition parameters, and their values. (i.e. entry 0 is a FME unit definition keyword, as defined in the coordinate systems section of the FME Reference Manual section 8.7.1, and entry 1 is its value. Entry 2 is the parameter name, entry 3 is its value, and so on.) There MUST be an even number of parameters.

Return type:

None

Raises:

FMEException – An FMEException is raised if there was an error.

getCoordSysAsOGCDef(coordSysName, ogcDef)

Gets the OGC definition of the coordinate system whose name is passed in.

Parameters:
  • coordSysName (str) – The name of the coordinate system the ogc definition is being retrieved for.

  • ogcDef (str) –

    The ‘ogcDef’ parameter takes in the following hint constants that define the form of the OGC definition.

    • ESRI: Translate to ESRI WKT format,

    • AUTODESK:Use the autodesk WKT exceptions file first before trying automated WKT conversion,

    • EPSG: Translate a FME name to an EPSG SRID code (which is also not OGC WKT at all),

    • MAPINFO: Convert a FME name to a MapInfo coordinate system string (which is also not OGC WKT at all),

    • PROJ4: Translate to a PROJ.4 string (not really OGC WKT at all of course),

    • ORACLE: Translate a FME name to an Oracle SRID code (which is also not OGC WKT at all),

    • PrettyWKT: Translate to nicely formatted WKT that is easier to read,

    • SimplifiedPrettyWKT: WKT, but strip out some of the useless stuff like AXIS definitions,

    • WKT1: Same as regular WKT but strip all parameters not listed in the Simple Features for SQL specification. This is needed for MapGuide for instance.

Return type:

str

Returns:

The target representation for the coordinate system. If the coordinate system does not have a target representation (but no errors occur) the return value will be set to an empty str. This could occur, for example, when no mapping exists between an Oracle SRID and a FME coordinate system.

Raises:

FMEException – An exception is raised if an error occurred.

getCoordSysList()

Retrieves the list of all supported coordinate system names.

Return type:

list[str] or None

Returns:

The list of all supported coordinate system names.

Raises:

FMEException – An exception is raised if an error occurred.

getCoordSysNameFromPrjFile()

getCoordSysNameFromPrjFile(prjFileName),

Returns a coord system name for the coordinate system represented by the contents of the .prj filename passed in The file is taken to hold an ESRI Well Known Text (WKT) representation of a coordinate system definition.

Parameters:

prjFileName (str) – The name of the .prj that contains the representation of the coordinate system or blank if any problems or errors occurred in retrieving the coordinate system from the file.

Return type:

str or None

Returns:

The unique name of the coordinate system that can be used within FME, or blank if any problems or errors occurred in retrieving the coordinate system from the file.

getCoordSysParms()

getCoordSysParms(coordSysName),

Returns the parameters associated with the coordinate system name in the pairwise ‘coordSysParms’ array.

Parameters:

coordSysName (str) – The name of the coordinate system the parameters are being retrieved for.

Return type:

list[str]

Returns:

Returns a pairwise list containing the parameters of the named coordinate system.

Raises:

FMEException – An exception is raised if an error occurred or the coordinate system could not be retrieved.

getCoordSysParmsAsFeature()

getCoordSysParmsAsFeature(coordSysName),

Retrieves the specified coordinate system and stores its definition in a returned feature.

Parameters:

coordSysName (str) – The name of the coordinate system the parameters are being retrieved for.

Return type:

FMEFeature

Returns:

The FMEFeature the coordinate system definition is being stored in.

Raises:

FMEException – An exception is raised if an error occurred.

getDatumParms()

getDatumParms(datumName),

Gets the definition of the datum whose name is passed in.

Parameters:

datumName (str) – The name of the datum the parameters are being retrieved for.

Return type:

list[str]

Returns:

The list storing the datum parameters. If no such datum exists, then an empty list is returned.

Raises:

FMEException – An exception is raised if an error occurred.

getEllipsoidParms()

getEllipsoidParms(ellipsoidName),

Gets the definition of the ellipsoid whose name is passed in.

Parameters:

ellipsoidName (str) – The name of the ellipsoid the parameters are being retrieved for.

Return type:

list[str]

Returns:

The list storing the ellipsoid parameters. If no such ellipsoid exists, then an empty list is returned.

Raises:

FMEException – An exception is raised if an error occurred.

getUnitParms()

getUnitParms(unitName),

Gets the definition of the unit whose name is passed in.

Parameters:

unitName (str) – The name of the unit the parameters are being retrieved for.

Return type:

list[str]

Returns:

The list storing the unit parameters. If no such unit exists, then an empty list is returned.

Raises:

FMEException – An exception is raised if an error occurred.

getUserCoordSysDefFiles()

Returns a list of all the files that coordinate system defs should be read from.

Return type:

list[str]

Returns:

List of files that coordinates system definitions should be read from.

Raises:

FMEException – An exception is raised if an error occurred.

readDefsFromFile()

readDefsFromFile(fileName),

Reads definitions for Coordinate systems, Datums, Ellipsoids, and Units from the specified file. If the file cannot be found or there is an invalid definition then an error code is returned.

Parameters:

fileName (str) – The name of the file the definition is read from.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

reprojectDirectory()

Return the directory where the reprojection subsystem support files live. Typically this is in FME_HOME/Reproject, but this call should be used to obtain it. FME_HOME can be obtained from the mapping file object using the normal ‘fetch’ call.

Return type:

str

Returns:

The directory where the reprojection subsystem support files live.

writePrjFile(prjFileName, coordSysName)

Writes a .prj file containing the ESRI Well Known Text representation of the coord system name passed in .

Parameters:
  • prjFileName (str) – The name of destination file the representation of the coordinate system will be written to.

  • coordSysName (str) – The name of the coordinate system.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.