ThinkGeo.com    |     Documentation    |     Premium Support

Adding multiple images

Hi,


I am trying to add multiple raster files to winformsMap control. I am getting "Parameter is not valid" exception when trying to call "Refresh()" method. Can someone help me out to display multiple raster files (tiff files) with world files?


Here is my code





 RectangleShape rectExtent = new RectangleShape(0.0, 0.0, 0.0, 0.0);
            foreach (string strFilename in strFileNames)
            {
                GdiPlusRasterLayer imageLayer = new GdiPlusRasterLayer(strFilename);
                imageLayer.UpperThreshold = double.MaxValue;
                imageLayer.LowerThreshold = 0;
                imageLayer.Open();

                rectExtent.ExpandToInclude(imageLayer.GetBoundingBox());
                winformsMap1.StaticOverlay.Layers.Add(Path.GetFileNameWithoutExtension(strFilename), imageLayer);
                imageLayer.Close();
            }
            winformsMap1.CurrentExtent = rectExtent.GetBoundingBox();
            winformsMap1.Refresh();



Thank you,

Suresh

Suresh, 
  
 I can’t recreate your issue. I added 2 tif files and the map shows fine. Can you find out which tiff file, or which tiff files case that issue and send those files to me so we can recreate it here? 
  
 Ben 


Hi Ben,


Thanks for the reply. Is my code provided in the original mail is correct? If so then I will send the tiff images I am trying to display. I am trying to display from the UNC path.


Thank you,


Suresh


 


 


 



Suresh, 
  
 Your code is correct. I tried to open files in another machine with UNC paths and it worked fine. Are your files in a remote machine? If yes can you copy the file to your local machine and have a try first? There might have some issues when getting a remote file like does not have access permission or something. 
  
 Also there are some known issues about opening tiff files with Map Suite. There are several kinds of tiff files, though they are all suffixed with .tif, Map Suite might have issues dealing with one of them. So if problem still exists, please send your file(s) to support@thinkgeo.com and ask to forward to Ben, we will have a look here. 
  
 Ben. 


Ben,


I just sent the two images to the support. Please get them and try to display using my code. It failed me on "Open" call.


Thanks,


Suresh



Suresh,


You didn’t send me the World Files so I created them myself. With the world files, your data works fine using the code in your original message. Here is the result and you can see the 2 pics are all added to map. You can change the position/size of the 2 images by modifying the World File. For more info about world file, please see here.
 
Also, here attached are the 2 World Files I’m using for test.
 
Ben

 



147-TiffWorldFiles.zip (288 Bytes)

Ben, 
  
 They are geotiff images and world file info is in the file. You use the listgeo utility on that file and it will list the world file info. Can MapSuite handle the cases where the world file is with in the file itself?  
  
 Thanks, 
 Suresh

Suresh, 
  
 I’m afraid we don’t support that case in the current version. It will be added in the near future and sorry for the inconvienence now. 
  
 Ben