A transformation provider supplies custom transformations between spatial reference systems. An implementation can either return a transformation or forward to the default transformation by returning undefined. Not all transformation strategies support custom transformations.

In your manifest.json:

"components": [{
"name": "MyCustomTransformationProvider",
"provides": "coordinatetransformer.CustomTransformationProvider"
}]

In your code (MyCustomTransformationProvider.ts):

export default class MyCustomTransformationProvider implements TransformationProvider
{
transformationFor(
sourceSRS: SpatialReference,
targetSRS: SpatialReference
):
| GeographicTransformation
| Items<Partial<GeographicTransformationStep>>
| undefined {
// Pseudo code
if (sourceSRS.wkid === 1234 && targetSRS.wkid === 4567) {
return {
wkid: 42007,
isInverse: false
};
}
return undefined;
}
}
interface TransformationProvider {
    transformationFor(
        sourceSpatialReference: SpatialReference,
        targetSpatialReference: SpatialReference,
    ): any;
}

Methods

  • Returns an (optional) custom transformation to apply when transforming between the two spatial reference system.

    This function can return an instance of GeographicTransformation directly (see details). It may also return a single object (a single transformation step) or an array of transformation steps for convenience. These will be used * to construct a GeographicTransformation internally.

    When returning an object, you should either specify the well known id (wkid) or the well known text (wkt) of the transformation. You can optionally specify isInverse to reverse the direction of the transformation. An array of such objects can be used to provide a series of transformation steps.

    Returning undefined indicates that the default transformation should be used, if one exists.

    Parameters

    • sourceSpatialReference: SpatialReference

      source spatial reference system

    • targetSpatialReference: SpatialReference

      target spatial reference system

    Returns any

    a custom geographic transformation.