RasterLayerClass won't release lock on image file when AxMapControl is disposed.

651
0
05-17-2011 07:19 AM
DougMarquardt
New Contributor
Hi:

Using VB.Net 2008 and ArcGIS Engine 2010 SP1.

I am dynamically downloading a *.jpeg file from http://msrmaps.com/ (used to be terraserver.usa) and
have no problem adding it as raster layer using the RasterLayerClass and CreateFromFilePath method (image shows up just fine on the map), however I want to delete the *.jpeg file when I'm done with it (after the the map control is disposed and AOUninitialize is called - the image is no longer needed).
I tried deleting the file after the form that contained the map control was disposed but was unable to do so.  Once I shutdown the entire application I can manually delete the file, but I want to delete the file automatically in code once I'm done with it.

Is there a better way to use the tempory image file rather than with RasterLayerClass and CreateFromFilePath so I can delete the image when I'm done with it, or perhaps there is a method to load the image directly into the default scratch workspace (which gets automatically deleted when the map closes) and then delete the source *.jpeg file?

Any suggestions?


Doug.
0 Kudos
0 Replies