Hi,
I am loading few layers on the map like shape files and image files. Once I add an ECW file, and it loads it, the application hangs. When I try to debug, it throws an error. The error does not occur within the function. It happens after loading the file.
I am attaching the screenshots.
What could be the possible reason? Could it be because I am changing the projection? This is the code I am using:
public void LoadECWImage(string strFilename){try{EcwRasterLayer ecwImageLayer = new EcwRasterLayer(strFilename);ecwImageLayer.UpperThreshold = double.MaxValue;ecwImageLayer.LowerThreshold = 0;// ecwImageLayer.Transparency = 30;ecwImageLayer.ImageSource.Projection = proj4;
LayerOverlay EcwOverlay = new LayerOverlay();
if (strOverlayTimeConstant == “True”){EcwOverlay.Layers.Add(“EcwLayer” + strdateTimeNow, ecwImageLayer);wpfMap1.Overlays.Add(“EcwOverlay” + strdateTimeNow, EcwOverlay);wpfMap1.Overlays[wpfMap1.Overlays.Count - 1].Name = “EcwOverlay” + strdateTimeNow;}else{//strdateTimeNow = DateTime.Now.ToString().Replace(’/’, ‘_’).Replace(’:’, ‘_’);strdateTimeNow = DateTime.Now.ToString(“ddMMyyyyhhmmssffff”);EcwOverlay.Layers.Add(“EcwLayer” + strdateTimeNow, ecwImageLayer);wpfMap1.Overlays.Add(“EcwOverlay” + strdateTimeNow, EcwOverlay);wpfMap1.Overlays[wpfMap1.Overlays.Count - 1].Name = “EcwOverlay” + strdateTimeNow;}
if (strOverlayTimeConstant == “False”){wpfMap1.Refresh();}
int intOverlayIndex = wpfMap1.Overlays.IndexOf(EcwOverlay);dtOverlayList.Rows.Add(“EcwOverlay” + strdateTimeNow, intOverlayIndex);
}catch (Exception ex){MessageBox.Show(ex.ToString());}
}
Thanks,
Jacob
Error_Stack_Trace.txt (3.14 KB)