Class GeographicTransformationStep
A geographic transformation step can be constructed from a well-known ID (WKID) that represents a known geographic
transformation, using the create(int)
factory method. Alternatively, a custom
transformation can be constructed from well-known text using create(String)
.
After creating a GeographicTransformationStep, one or more steps can be added to a GeographicTransformation
,
and used to project
a Geometry.
// Create a geometry located in London, UK, with British National Grid spatial reference
Point britishNationalGridPt = new Point(538985.355, 177329.516, SpatialReference.create(27700));
// Create a GeographicTransformation with a single step using WKID for OSGB_1936_To_WGS_1984_NGA_7PAR transformation
GeographicTransformation transform = GeographicTransformation.create(GeographicTransformationStep.create(108336));
// Project the point to WGS84, using the transformation
Point wgs84Pt = (Point) GeometryEngine.project(britishNationalGridPt, SpatialReferences.getWgs84(), transform);
This SDK supports thousands of geographic transformation WKIDs, which are documented in the developer Guide on the ArcGIS for Developers site. The list of supported WKIDs includes a transformation from every supported datum to WGS 1984. Additionally, there is a more limited list of transformations directly between two non-WGS84 datums, such as 4461, which is NAD_1983_HARN_To_NAD_1983_NSRS2007_1.
Alternatively, transformations can be created by using methods of the TransformationCatalog
class.
Some geographic transformations rely on supporting files to be present in a known location (see
TransformationCatalog.getProjectionEngineDirectory
).
Use isMissingProjectionEngineFiles()
to identify transformations for which the supporting files are missing.
If true, then the transformation cannot be used to project geometries. Use getProjectionEngineFilenames()
to
identify which files are missing for this step.
Geographic transformation steps are immutable. Use getInverse()
to get a new step representing the same
transformation in the opposite direction.
- Since:
- 100.2.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic GeographicTransformationStep
create
(int wkid) Creates a GeographicTransformationStep instance from the given well-known ID (WKID).static GeographicTransformationStep
Creates a GeographicTransformationStep instance from the given well-known text (WKT) string.boolean
Tests if this object is equal to a second GeographicTransformationStep object.Gets the inverse of this geographic transformation step.Gets the filenames that comprise the supporting dataset for this transformation.int
getWkid()
Gets the well-known ID (WKID) representation of this GeographicTransformationStep.Gets a string containing the well-known text representation of this GeographicTransformationStep.int
hashCode()
Generates a hash value from the GeographicTransformationStep.boolean
Indicates if this geographic transformation step instance is an inverted transformation.boolean
Indicates if any files needed by the Projection Engine for this geographic transformation step are missing from the local file system.
-
Method Details
-
create
Creates a GeographicTransformationStep instance from the given well-known ID (WKID).If the WKID defines a grid-based transformation, the transformation can only be used if the supporting files are found on the local file system. See
isMissingProjectionEngineFiles()
.Occasionally, WKIDs may change, and older codes may be deprecated in favor of a new code. Both old (deprecated) and new (latest) WKIDs continue to work for instantiation, as long as they are supported by the Projection Engine. The
getWkid()
property will return the new (latest) WKID code.- Parameters:
wkid
- a WKID of the geographic transformation step to create- Returns:
- a GeographicTransformationStep instance
- Throws:
ArcGISRuntimeException
- if wkid is invalid (is not a supported WKID). The list of supported WKIDs is documented in the developer Guide.- Since:
- 100.2.0
- See Also:
-
create
Creates a GeographicTransformationStep instance from the given well-known text (WKT) string.Some users adjust the components of a geographic transformation to suit their specific needs. These custom transformations use the existing methods of transformation (Position Vector, Geocentric_Translation, and so on) but have different parameter values than the well-known definitions. Create a custom geographic transformation object by passing in a text string containing your custom transformation expressed in WKT format. The resulting geographic transformation will have a WKID of zero.
If the WKT defines a grid-based transformation, the transformation can only be used if the supporting files are found on the local file system. See
isMissingProjectionEngineFiles()
.- Parameters:
wkText
- a string containing a WKT representation of a GeographicTransformationStep- Returns:
- a GeographicTransformationStep instance
- Throws:
IllegalArgumentException
- if wkText is null or emptyArcGISRuntimeException
- if wkText is invalid (is not a well-formed geographic transformation text string)- Since:
- 100.2.0
- See Also:
-
getInverse
Gets the inverse of this geographic transformation step.The inverse of a transformation converts coordinates using the same method and parameters, but in the opposite direction of the original object. For example if the original object represents NAD_1983_HARN_To_NAD_1983_NSRS2007_1 transformation, then the inverse will transform from NAD83 (NSRS 2007) to NAD83 (HARN).
To check the input and output SpatialReferences of a transformation step, add the step to a new GeographicTransformation, and check
DatumTransformation.getInputSpatialReference()
andDatumTransformation.getOutputSpatialReference()
.- Returns:
- the inverse of this geographic transformation step or null if the transformation is not invertible
- Since:
- 100.2.0
-
isInverse
public boolean isInverse()Indicates if this geographic transformation step instance is an inverted transformation.Transformations have a specific direction that is indicated by the
getWkText()
value. An inverted transformation is used to transform geometries in the opposite direction to that indicated by the Well-Known Text. TheGeographicTransformation
hasDatumTransformation.getInputSpatialReference()
andDatumTransformation.getOutputSpatialReference()
properties that respect the inverse value of the contained transformation(s).This API supports a large number of transformation WKIDs, including transformations from every supported datum to the World Geodetic System 1984 (WGS84) datum. To transform coordinates between two non-WGS84 datums, typically one forward and one inverse GeographicTransformationStep are added to a GeographicTransformation, to get the required inputs and outputs.
- Returns:
- true if this geographic transformation step instance is an inverted transformation; false otherwise
- Since:
- 100.10.0
-
getWkText
Gets a string containing the well-known text representation of this GeographicTransformationStep.- Returns:
- a well-known text representation of this GeographicTransformationStep
- Since:
- 100.2.0
-
getWkid
public int getWkid()Gets the well-known ID (WKID) representation of this GeographicTransformationStep.The list of supported WKIDs is documented in the developer Guide.
Occasionally, WKIDs may change, and an older code may be deprecated in favor of a new code. This property returns the new (latest) WKID code.
- Returns:
- a WKID representation of this GeographicTransformationStep, or 0 if this transformation was created from a custom well-known text string, or -1 on error.
- Since:
- 100.2.0
-
isMissingProjectionEngineFiles
public boolean isMissingProjectionEngineFiles()Indicates if any files needed by the Projection Engine for this geographic transformation step are missing from the local file system.If true, this indicates that this transformation step is not currently usable; in this case, using the
GeometryEngine.project(Geometry, SpatialReference, DatumTransformation)
method with a transform including this step will throw an exception. In order for a transform step to be usable, two conditions must be satisfied:- In order for any Projection Engine files to be found, the root directory must have been successfully set
before any transforms are used, using
TransformationCatalog.setProjectionEngineDirectory(String)
. If the default Projection Engine directory is found during API initialization, explicitly setting the location is not required. - The specific Projection Engine files required by this step must be found within the Projection Engine
directory. Use
getProjectionEngineFilenames()
to find out the filenames required by this step.
If Projection Engine files are installed at run time, the app will need to be restarted for this value to change.
- Returns:
- true if any required files are missing; false otherwise
- Since:
- 100.2.0
- In order for any Projection Engine files to be found, the root directory must have been successfully set
before any transforms are used, using
-
getProjectionEngineFilenames
Gets the filenames that comprise the supporting dataset for this transformation.Projection Engine datasets are used by grid-based transformations; equation-based transformations do not require any supporting files.
Each filename includes the path relative to
TransformationCatalog.getProjectionEngineDirectory()
, indicating the subdirectory (or directories) and the filename including extension.- Returns:
- an unmodifiable List of the filenames that comprise the supporting dataset, or an empty List if this step does not require supporting files (is an equation-based transformation).
- Since:
- 100.2.0
-
equals
Tests if this object is equal to a second GeographicTransformationStep object. Returns true if the two transformation steps use the same method of transformation, and operate in the same direction. -
hashCode
public int hashCode()Generates a hash value from the GeographicTransformationStep.
-