CreateImageryLayer creates an imagery layer in the 3D window. Adding the image uses a set of plugins that support multiple file formats. The coordinates of the source can be passed via the UpperLeftX/Y and LowerRightX/Y parameters. If all four coordinate field values are zero, the coordinate information, if available, is read from the file. If the source file coordinate system is not the same as the MPT file Terrain Coordinate system, you can reproject it using the ITerrainRasterLayer::SetLayerCS() method.
HRESULT CreateImageryLayer(
[in] BSTR ImageryFileName,
[in] double UpperLeftX,
[in] double UpperLeftY,
[in] double LowerRightX,
[in] double LowerRightY,
[in, optional, defaultvalue(0)] VARIANT InitParam,
[in, optional, defaultvalue("")] VARIANT PlugName,
[in, optional, defaultvalue(0)] long GroupID,
[in, optional, defaultvalue("")] BSTR Description,
[out, retval] ITerrainRasterLayer** pITerrainRasterLayer5)
Parameters:
ImageryFileName – A full pathname to the image to import to the terrain.
UpperLeftX – The West-East coordinate of the image upper left corner. If all four coordinate field values are zero, the coordinate information, if available, is read from the file. If you are working in a Lat-Long format, the Lat-Long values should be in decimal Lat-Long.
UpperLeftY – The North-South coordinate of the image upper left corner. If all four coordinate field values are zero, the coordinate information, if available, is read from the file. If you are working in a Lat-Long format, the Lat-Long values should be in decimal Lat-Long.
LowerRightX – The West-East coordinate of the image lower right corner. If all four coordinate field values are zero, the coordinate information, if available, is read from the file. If you are working in a Lat-Long format, the Lat-Long values should be in decimal Lat-Long.
LowerRightY – The North-South coordinate of the image lower right corner. If all four coordinate field values are zero, the coordinate information, if available, is read from the file. If you are working in a Lat-Long format, the Lat-Long values should be in decimal Lat-Long.
InitParam – Reserved. Currently not used.
PlugName – The name of the plugin used to read the file, e.g., “tifplg.rct“. The available plugins are files with RCT extension, that exist in the “TBPlugs“ directory. If an empty string is passed into this parameter, the default plugin for the file type is used.
GroupID – The Information Tree group in which the imagery layer is created. If it is set to zero, the object is created under the root. You can obtain the GroupID by one of the following methods:
Create the group the IInformationTree5::CreateGroup.
If you know the name of the group, find it using IInformationTree5::FindItem.
Traverse the Tree using IInformationTree5 methods such as GetNextItem, until you come to the desired GroupID.
Description –The name of the imagery layer as it appears in the Information Window. If an empty string is passed into this parameter, TerraExplorer assigns it a unique name.
pITerrainRasterLayer5 – An interface pointer to the newly created imagery layer. This parameter must not be Null.
Return Values:
The return value obtained from the returned HRESULT can be one of the following:
Return value |
Meaning |
S_OK |
Success. |
E_FAIL |
Catastrophic failure. |
TE_E_MPTNOTLOADED |
An MPT file must be loaded in TerraExplorer for this method to work. |
TE_E_INFOTREE_PARENTNOTGROUP |
The group ID entered does not represent a valid group in the information tree. |
TE_E_INTERNAL |
TerraExplorer was unable to create the object. To get more information about this error use IErrorInfo Interface. |
TE_E_NOLICENCE |
Your license does not allow the use of this feature. |