How to load a raster back into a raster dataset without file I/O?

2499
2
Jump to solution
01-30-2014 05:45 AM
MichaelEber
Occasional Contributor
I have this fairly complex routine running as a service.  All was well right up until I called one of the methods and instead of returning a RasterDataset as an IGeoDataset it returned an IRaster as the IGeoDataset.  I need a consistent way of passing this modified raster throughout the code and I was using a RasterDataset for doing that.  But no matter what I do I cannot get that modified raster into the dataset without (apparently) saving it to disk.  I want to avoid this since File I/O on a service is evil.  And ESRI doesn't have modern software so it does not take a stream as input for loads preventing me from using a memory stream.

So any suggestions on how to load the modified raster back into the RasterDataset without saving to disk?
0 Kudos
1 Solution

Accepted Solutions
ErinBrimhall
Occasional Contributor II
Have you looked at the SaveAsRasterDataset method off the ISaveAs2 interface?

Also, the IRaster2 interface has a RasterDataset property, which might be what you're looking for.

View solution in original post

2 Replies
ErinBrimhall
Occasional Contributor II
Have you looked at the SaveAsRasterDataset method off the ISaveAs2 interface?

Also, the IRaster2 interface has a RasterDataset property, which might be what you're looking for.
MichaelEber
Occasional Contributor
I was trying to avoid doing any saving.  Typically, in a normal server environment, doing a file write causes a lock on the mutex which momentarily halts all services running on the server.

But the IRaster2 interface looks like it is just what I was looking for....assuming that RasterDataset isn't null.  🙂

Thank you!
0 Kudos