Hi Ben,
Thanks for the info, I tried doing that and I get the streams loaded but I'm getting a new error now when opening the RasterLayer. Its below, I'm also attaching a dumb of the memory stream I created the world file in to the hard drive, which has six lines in it. Below is the exception and the code that writes to the stream.
Thanks
System.ArgumentException occurred
Message="World file should has 6 lines.\r\nParameter name: worldFileText"
Source="MapSuiteCore"
ParamName="worldFileText"
StackTrace:
at ThinkGeo.MapSuite.Core.WorldFile..ctor(String worldFileText)
at ThinkGeo.MapSuite.Core.GdiPlusRasterSource.xa52a84e48240d21b(Stream xf616ee320c8f54d8)
at ThinkGeo.MapSuite.Core.GdiPlusRasterSource.OpenCore()
at ThinkGeo.MapSuite.Core.RasterSource.Open()
at ThinkGeo.MapSuite.Core.RasterLayer.OpenCore()
at ThinkGeo.MapSuite.Core.Layer.Open()
at Tcc.Gis.ThinkGeoTestApp.Form1..ctor() in C:\TFSSource\TCC\GIS\Tcc.Gis.ThinkGeoTestApp\Form1.cs:line 42
InnerException:
public void SaveToStream(Stream stream, bool closeStreamWhenFinished)
{
// Nothing to save if embedded
if( IsEmbedded )
return;
StreamWriter writer = null;
try
{
writer = new StreamWriter(stream);
// Write 6 lines.
writer.WriteLine(PixelSizeX);
writer.WriteLine(RotationX);
writer.WriteLine(RotationY);
writer.WriteLine(PixelSizeY);
writer.WriteLine(UtmX);
writer.Write(UtmY);
//Flush the writer in case we don't close it
writer.Flush();
}
catch( Exception exc )
{
throw exc;
}
finally
{
if( writer != null && closeStreamWhenFinished )
writer.Close();
}
}
580-worldfile.txt (48 Bytes)