ThinkGeo.com    |     Documentation    |     Premium Support

How to release the lock on the file created by GdiPlusRasterLayer

When you construct an instance of the GdiPlusRasterLayer class using a file name, it locks the file at the O/S level. What I'd like to do is re-use the same file name in order to store new raster images when the user switches map themes (from streets to hybrid mode, let's say). Each time I download a raster image I try to re-use the same file name, but then run into the locked file issue.


I remove the overlay from the map's overlay list, but that does not release the lock on the file at the O/S level.


What's the best way to do this?



Gregory,


I think the way to release the lock on the file is close the layer as following way:

GdiPlusRasterLayer a = (GdiPlusRasterLayer)winformsMap1.FindRasterLayer("WorldImageLayer");
a.Close();

 

Any more questions please feel free to let me know.
 
Thanks.
 
Yale


That seemed to do the trick, Yale - thanks!

Gregory, 
  
 Thanks for letting us know your status! 
  
 Any more questions please feel free to let me know. 
  
 Thanks. 
  
 Yale