ThinkGeo.com    |     Documentation    |     Premium Support

MrSID file type can't be loaded

Im loading satellite images of MrSID file type, it has .sid and .sdw.  From the installed axamples, i see that "world,sid" and "world.sdw" can be displayed correctly. But when i use other SID files, it won't display. Here is a place to download some MrSID files:


nconemap.com/Default.aspx?tabid=286


Under Raster category, i downloaded some SID files and used MrSID viewer to view them, it can be viewed. But when i use ThinkGeo to display, nothing is on the screen.  Is there something i have to adjust or its an incompatibility?


 


Ric






 


Ric,


I downloaded the following 2 files and they are all displayed well with Map Suite Desktop Edition. 


ftp://204.211.239.203/outgoing/raster/drg/abbott.sid


ftp://204.211.239.203/outgoing/rast...bbott1.sid


I'm using the 3.0.199 edition and here is my code. Can you have a check what's the differences? Also, just a quick trick that just drag and drop the sid file to the MapSuite Explorer, you will see if it is supported by Map Suite.


 



           winformsMap1.MapUnit = GeographyUnit.Meter;
           MrSidRasterLayer mrSidRasterLayer = new MrSidRasterLayer(@"C:\Posts\Sid Data\abbott.sid");
            mrSidRasterLayer.Open();
            winformsMap1.CurrentExtent =  mrSidRasterLayer.GetBoundingBox();
            mrSidRasterLayer.Close();
            winformsMap1.StaticOverlay.Layers.Add(mrSidRasterLayer);
        
            winformsMap1.Refresh();

Thanks,


 


Ben




Ben, your code worked. I didnt open and close the layer and get a correct currentExtent thats why it didnt work before. However, i noticed the latitude ang longitude derived was wrong, it gave me very big numbers like "632587.84328, 96851.26119". i tried GeographyUnit of Meters, DecimalDegree…etc but all the same. I also tried other .SID files, also the same. Is there something we should do when using MrSid layers?

Here is my code:

private void Form1_Load(object sender, EventArgs e)
{
    winformsMap1.MapUnit = GeographyUnit.Meter;
    MrSidRasterLayer mrSidRasterLayer = new MrSidRasterLayer(@"C:\Maps\abbott1.sid");
    mrSidRasterLayer.Open();
    winformsMap1.CurrentExtent = mrSidRasterLayer.GetBoundingBox();
    mrSidRasterLayer.Close();

    winformsMap1.StaticOverlay.Layers.Add("MrSidLayer", mrSidRasterLayer);
    winformsMap1.Refresh();
}

private void winformsMap1_MouseMove(object sender, MouseEventArgs e)
{
    ScreenPointF lastMouseMove = new ScreenPointF(e.X, e.Y);
    PointShape mouseLocation = ExtentHelper.ToWorldCoordinate(winformsMap1.CurrentExtent, lastMouseMove, winformsMap1.Width, winformsMap1.Height);

    //update the world location on screen 
    lblWorldPos.Text = string.Format(CultureInfo.InvariantCulture, "({0}, {1})", mouseLocation.X.ToString("N5", CultureInfo.InvariantCulture), mouseLocation.Y.ToString("N5", CultureInfo.InvariantCulture));
}


Ric




 


Ric,


That's because the sid files are within the projection other than DecimalDegrees. For example, the abbott1.sid is under Grid_Coordinate_System_Name: State Plane Coordinate System 1983 projection


nconemap.com/nconemap_meta/doqq98_faq.htm


In fact, the raster map images are usually not within DecimalDegrees which is not a projected coordinate system for showing map on a flat plane. So usually if we want to show vector data in Decimal Degrees with a raster image together, we need to convert the projection from DecimalDegrees to whatever the raster image has. Here in a post includes some idea how to do the projection conversion in Desktop.


gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/5490/afv/topic/Default.aspx  


A way you can kind of convert a MrSid image to DecimalDegrees is to change its world file. The .sdw file is the world file for MrSid, it only includes 6 doubles and by changing those, you can change the extent of that image. Following is the specification of a world file and just make sure that it is kind of a hack, the correct way is always to convert the DecimalDegrees to the Raster Image's projection.


en.wikipedia.org/wiki/World_file


Thanks,


Ben






when i use the above sample code, i get "Count find MapsuiteGeoRasterX86.dll assembly" error while opening Raster file. (mrSidRasterLayer.Open(); 
 ) 
 I am using version 5.5 and on X86. If i assign the CurrentExtent  manually then no error but the image doesnt display. Please guide me on the problem.

Hello rajanikanth, 
  
 The MapSuiteGeoRasterX86.dll should be copied over to Windows\System32 folder automatically when you install the product. Could you please double check it? If it is not, you can find that DLL in \Program Files\ThinkGeo\Map Suite Wpf Desktop Full Edition 5.5\Developer Reference\System32\System32\Map Suite 5.5, and copy it over to Windows\System32 folder.  
  
 Regards, 
  
 Gary