How to access OGC WCS coverage


Accessing OGC WCS coverage

To access a coverage served through an Open Geospatial Consortium (OGC) Web Coverage Service (WCS) server, see the following code example:
[C#]
//WCS service uniform resource locator (URL).
string URL = "http://liaoning1/arcgis/services/dem/mapserver/wcsserver?";

//Create WCSLayer from the first coverage.
IWCSLayer wcslayer = new WCSLayerClass();
wcslayer.Create(URL, "1", "1.0.0");

//Access raster.
IRasterLayer rasterlayer = (IRasterLayer)wcslayer;
IRaster2 raster = (IRaster2)rasterlayer.Raster;

//Access raster dataset.
IRasterDataset rasterdataset = raster.RasterDataset;
[VB.NET]
'WCS service uniform resource locator (URL).
Dim URL As String = "http://liaoning1/arcgis/services/dem/mapserver/wcsserver?"

'Create WCSLayer from the first coverage.
Dim wcslayer As IWCSLayer = New WCSLayerClass()
wcslayer.Create(URL, "1", "1.0.0")

'Access raster.
Dim rasterlayer As IRasterLayer = CType(wcslayer, IRasterLayer)
Dim raster As IRaster2 = CType(rasterlayer.Raster, IRaster2)

'Access raster dataset.
Dim rasterdataset As IRasterDataset = raster.RasterDataset






To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing Deployment licensing
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo
Engine Developer Kit Engine Runtime