CreateImageryLayer

Loads an imagery layer into the project. 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 ITerrainRasterLayer80. CoordinateSystem.  

For advanced layers, e.g. from WMS and SGS, string parameters must be passed that describe the plugins used to read the files and their persistence strings (InitParam and PlugName). To retrieve these parameter values, add layers of the required types from TerraExplorer GUI, and then call ITerrainRasterLayer.InitParam and ITerrainRasterLayer.PlugName. You can then use the values returned by these properties to create additional advanced layers.   

 

JavaScript

 

CreateImageryLayer(

       ImageryFileName,

       UpperLeftX,

       UpperLeftY,

       LowerRightX,

       LowerRightY,

       InitParam,

       PlugName,

       GroupID,

       Description )

 

C#

 

ITerrainRasterLayer80 CreateImageryLayer(

       string        ImageryFileName,

       double        UpperLeftX,

       double        UpperLeftY,

       double        LowerRightX,

       double        LowerRightY,

       object        InitParam = "",

       object        PlugName = "",

       string        GroupID = "",

       string        Description = "")

 

C++

 

HRESULT CreateImageryLayer(      

        BSTR         ImageryFileName,

        double      UpperLeftX,

        double      UpperLeftY,

        double      LowerRightX,

        double      LowerRightY,

        VARIANT     InitParam,

        VARIANT     PlugName,

        LONG_PTR    GroupID,

        BSTR         Description,

        ITerrainRasterLayer80 **  pITerrainRasterLayer80) 

Parameters

ImageryFileName

A full path name to the image to import to the terrain.

UpperLeftX

The West-East coordinate of the imagery layer’s upper left corner in the project’s coordinate system units. If all four coordinate field values are zero, the coordinate information, if available, is read from the file.

UpperLeftY

The North-South coordinate of the imagery layer’s upper left corner in the project’s coordinate system units. If all four coordinate field values are zero, the coordinate information, if available, is read from the file.

LowerRightX

The West-East coordinate of the imagery layer’s lower right corner in the project’s coordinate system units. If all four coordinate field values are zero, the coordinate information, if available, is read from the file.

LowerRightY

The North-South coordinate of the imagery layer’s lower right corner in the project’s coordinate system units. If all four coordinate field values are zero, the coordinate information, if available, is read from the file.

InitParam

The persistence string used by some plugins, e.g., to describe layer information, for layers not stored on a local storage drive, such as WMS or SGS layers. This string can be retrieved by ITerrainRasterLayer.InitParam.

PlugName

The name of the plugin used to read the file, e.g., “gdlplg.rct“. The available plugins are files with RCT extension that exist in the “TBPlugs directory. This string can be retrieved by ITerrainRasterLayer.PlugName. If an empty string is passed into this parameter, the default plugin for the file type is used.

GroupID

The Project Tree group in which the imagery layer is created. If it is set to an empty string, the object is created under the root. You can obtain the GroupID by one of the following methods:

·          Create the group using IProjectTree80.CreateGroup.

·          Find the group, if you know the name, using IProjectTree80.FindItem.

·          Traverse the Tree using IProjectTree80 methods such as GetNextItem, until you come to the desired GroupID.

Description

The name of the imagery layer as it appears in the Project Tree. If an empty string is passed into this parameter, TerraExplorer assigns it a unique name.

Return Value

pITerrainRasterLayer80

An ITerrainRasterLayer80, representing the newly created imagery layer.

Exceptions

See: HRESULT Return Values for a list of possible values returned by the HRESULT.