Hexagon Geospatial
MENU

Shared Samples

GeoMedia, a comprehensive and dynamic GIS, extracts compelling intelligence from geospatial data and integrates it to present actionable information. Please note a HGDN subscription is required to download code samples
Showing results for 
Search instead for 
Do you mean 

Displaying ECW File

by Technical Evangelist ‎09-15-2015 06:23 AM - edited ‎09-15-2015 07:59 AM (707 Views)

The Display ECW sample application is an example of a GeoMedia custom application. It's primary purpose is to demonstrate raster automation.

 

The source code and instruction may be found on Bitbucket: HGDN_GEOMEDIA / App_DisplayECW_2015CS

 

Related code snippets

 

string sECWFile;
sECWFile = sPath + "\\2540500_5712000.ecw";

PRaster.RasterPropertiesService oRasterService = new PRaster.RasterPropertiesService(); object oDisplayMatrix = null; object vRange = null; object oCS; oRasterService.Filename = sECWFile; oRasterService.GetPositionInfo(8, out oDisplayMatrix, out vRange, out oCS); oCSM.CoordSystem.LoadFromFile(sPath + "\\EPSG25832.csf"); oCS = oCSM.CoordSystem; PRaster.RasterGeometry oRasterGeometry = new PRaster.RasterGeometry(); oRasterGeometry.DisplayMatrix = oDisplayMatrix; oRasterGeometry.Filename = sECWFile;
// Create title 
PClient.GMProperty objgmprop = new PClient.GMProperty();
objgmprop.Name = "Title";
objgmprop.Value = sECWFile;

// Create a style 
PView.StyleService objStyleService = new PView.StyleService();
PView.StyleDefinition objStyleDef = null;
objStyleService.GetStyle("Image Style", out objStyleDef);

// Create the raster legend entry. 
// IMPORTANT: We don't need to transform the geometry since  the data
// and map view control use the same CS
PView.LegendEntry oRasterLE = new PView.LegendEntry();
oRasterLE.InputRecordset = oRecSet;
oRasterLE.GeometryFieldName = "Geometry";
oRasterLE.Style = objStyleDef;
oRasterLE.PropertySet.Append((PDBPipe.GMProperty)objgmprop);

// Append the legend entry to the legend and load the data on 
// the map view. 

ocxMapView.Legend.LegendEntries.Append(oRasterLE);
oRasterLE.LoadData(true);
ocxMapView.Fit();
ocxMapView.Refresh();

 

Overview
Contributors