Unable to change AreaOfInterest of an object of type ILayer

Discussion created by giltvil on Dec 14, 2011
Latest reply on Dec 15, 2011 by Neil
In my code, I am opening a raster dataset and creating an object of type IRasterLayer.
After that, I am casting my IRasterLayer to ILayer and saving it in an object of type ILayer.
Now, what I am trying to do is to take the ILayer object and change it's AreaOfInterest, but its readonly.
Even tried to set it's max-min points and union the envelope with another envelope but none had brought me luck.
It is essential for me to change the ILayer AreadOfInterest in my own envelope because my target is to project the ILayer object from one spatial reference to one another.
I have found out that if casting back the ILayer to IRasterLayer it is possible to change the spatial reference of the IRasterLayer and that is causing for a projection in the ILayer object, and yet it is not sufficient for me since i am using a projection with my own paramaters and not the defaults of ESRI.

I will be greatful if any of you can help me to figure out how can I change the whole envelope of the ILayer.AreaOfInterest myself without using the other way that I have already found out.

Best regards, Gil Tvil.