Create a custom geodata transform


Purpose
ArcGIS supports many geodata transforms such as RPCXFrom and PolynomialXForm for transforming pixel coordinates to map coordinates and vice versa. This sample shows how to create a custom geodata transform.

How to use

If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Compile and build the solution and generate CustomXForm.dll.
  2. Register CustomXForm.dll.
  3. To transform a raster using SimpleXForm, modify the GeodataXForm on a geodataset. It will then be persisted to the geodataset, as shown in the code example in the Additional information section below.
  4. To transform a raster using RMCXForm, download and unzip the Custom GDAL Driver sample.
  5. If you're using an existing GDAL driver, follow these steps: a) Compile rmcdataset.cpp from stage2 to create gdal_RMC.dll; b) Copy the .dll file to the GDAL plugins directory; c) Register the format with ArcGIS (using the New Format Properties dialog box or by editing RasterFormats.dat); and d) Copy RasterXforms.dat to the ArcGIS bin directory (or modify the existing file if present).
  6. If you're using a new GDAL driver (using GDAL XML Metadata), follow these steps: a) Compile rmcdataset.cpp from stage3 to create gdal_RMC.dll; b) Copy the .dll file to the GDAL plugins directory; c) Register the format with ArcGIS if not done previously; and d) Edit RasterXforms.dat to remove the RMCXform entry (it's not needed in this case).
  7. Ensure rmcdata\rmcS.rmc has the correct file paths to the data files.
  8. Start ArcMap, navigate to rmcdata, and open rmcS.rmc.

Additional information

To create a custom geodata transform, you will create a GeodataXForm class by implementing the IGeodataXform, IPersistStream, and IClone interfaces.
The C++ sample solution implements two custom GeodataXforms, SimpleXform and RMCXform, which are hosted in a dynamic-link library (DLL), CustomXform.dll. The two custom geodata transforms are used in different ways as follows:
  • To use the SimpleXform class, open a raster dataset and use the IGeoDatasetSchemaEdit2 interface to assign the geodata transform to the raster dataset as shown in the following code example:
  • Sub ApplySimpleXForm(pRasterDataset As IRasterDataset)
        ' This procedure creates a SimpleXForm and persists it to the raster dataset.
        'Create simplexform.
        Dim pSimpleXForm As ISimpleXForm
        Set pSimpleXForm = New SimpleXForm
     
        'Persist the xform to the input raster dataset.
        Dim pGeoDatasetEdit As IGeoDatasetSchemaEdit2
        Set pGeoDatasetEdit = pRasterDataset
     
        Dim pSimpleXForm As ISimpleXForm
        Set pSimpleXForm = New SimpleXForm
     
        pGeoDatasetEdit.AlterGeodataXform pSimpleXForm
    End Sub
  • To use the RMCXform sample, you will also have to implement one of the scenarios from the CustomGDALDriverSample available as a download from the ArcGIS Image Management Resource Center code gallery. The RMCXform is specifically designed to work with the encoded rmcS.rmc file.


SimpleXForm.cpp Implementation file for the SimpleXForm COM object.
CustomXForm.cpp Implementation file for the CustomXForm COM object.
SimpleXForm.h Header file for the SimpleXForm COM object.
CustomXForm.h Header file for the CustomXForm COM object.
RMCXForm.cpp Implementation file for the RMCXform COM object.
RMCXForm.h Header file for the RMCXform COM object.
Download the VCPP files

Download the files for all languages




Additional Requirements
  • CustomGDALDriverSample, available at the ArcGIS Image Management Resource Center code gallery

Development licensing Deployment licensing
ArcGIS for Desktop Basic ArcGIS for Desktop Basic
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced