ThinkGeo.com    |     Documentation    |     Premium Support

Unable to Load JPEG 2000 images

I am having a problem loading a JP2000 Image. I am running Windows 7 64bit. I don't have problem loading any other image type. I have successfully ran all the How To samples and also have tested Mr. Sid.  I also can view the .jp2 file in other software, e.g. lizardtech geoviewer and ESRI ArcMap. The images I have are quite large 1.81 GB and  1.27GB.


 I use the following code to load the image:


Jpeg2000RasterLayer jp2ImageLayer = new Jpeg2000RasterLayer(filename);

jp2ImageLayer.UpperThreshold = double.MaxValue;

jp2ImageLayer.LowerThreshold = 0;

            

LayerOverlay imageOverlay = new LayerOverlay();

imageOverlay.Layers.Add("SidImageLayer",jp2ImageLayer);

winformsMap1.Overlays.Add(imageOverlay);

jp2ImageLayer.Open();

winformsMap1.MapUnit = GeographyUnit.Meter;

winformsMap1.CurrentExtent = jp2ImageLayer.GetBoundingBox();

jp2ImageLayer.Close();

           

winformsMap1.Refresh();


I get two problems. When I try to open the layer, jp2ImageLayer.Open();  I get a warning:


The assembly named 'MapSuiteEcwX64' was loaded from 'file:///C:/Windows/SysWow64/MapSuiteGeoRasterX64/MapSuiteEcwX64.DLL' using the LoadFrom context. The use of this context can result in unexpected behavior for serialization, casting and dependency resolution. In almost all cases, it is recommended that the LoadFrom context be avoided. This can be done by installing assemblies in the Global Assembly Cache or in the ApplicationBase directory and using Assembly.Load when explicitly loading assemblies.


I am able to continue and get the dreaded vshost.exe has stopped working after winformsMap1.Refresh(); It outputs three files into my temp directory.One .txt and one .xml. It also dumps what appears as a binary file *.hdmp, which is 123MB. I have attached the .txt and .xml file.


Any feedback is greatly appreciated. Thanks!


Eric


 



1853-WERFC2.tmp.appcompat.txt (13.5 KB)
1854-WERFADB.tmp.WERInternalMetadata.xml (3.9 KB)

Eric,


Can you have a quick try to see if it works by changing the compile mode to X86 at the top of tool tips in VS2008 (I suppose)?

 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale

Thanks for the quick reply Yale!


I changed my compile mode to X86. I thought you had nailed it as my development projects are all this was. The test project I had created for loading images was set to "Any CPU". I changed it with no luck. get a slightly different warning as it does indicate X86:


The assembly named 'MapSuiteEcwX86' was loaded from 'file:///C:/Windows/SysWow64/MapSuiteGeoRasterX86/MapSuiteEcwX86.DLL' using the LoadFrom context. The use of this context can result in unexpected behavior for serialization, casting and dependency resolution. In almost all cases, it is recommended that the LoadFrom context be avoided. This can be done by installing assemblies in the Global Assembly Cache or in the ApplicationBase directory and using Assembly.Load when explicitly loading assemblies


and then the same vshost32.exe has stopped working, but now with out the details and the error:


AN unhand led win32 exception occurred in ImageBrowser.vshost.exe [10244].


where ImageBrowser is the name of my application.


Why is the the Jpeg2000RasterLayer using "MapSuiteEcwX86"?


Any Ideas?


Eric


 



Eric, 
  
 Thanks for your reply. 
  
 Yes, as you think about, in the behind sense, we use the ECW library to load the Jpeg2000RasterSource. 
  
 Could you check that the DLL(MapSuiteEcwX86.DLL) is already located in the target folder? Also, did you try a comparably small Jpeg2000 file to see it works, if not, could you send me that file, I will try to recreate it. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale 


Yale, 
 I tried a few other jp2 files I found on the internet. They were not aerial images and not georectified, not that this should matter I guess. Anyway, same results. I do have the X86 and x64 MapSuite SysWow folders with respective dlls. The file I am using is 1.21 GB. I am unsure if this is a file I should upload via the forum. I will await your instructions before uploading the file. 
  
 Better yet, you can obtain the jp2000 files from State of Virginia, just as I did. 
 gismaps.virginia.gov/NAIP/ 
 I am trying to use  Stafford and Spotsylvania counties. 
  
 Thanks for your help. 
  
 Eric

Eric,


Thanks for your feedback, I am starting to download the data from the website which seems take more than 1 day to download.
 
Now I used a small jp2 file for test , and it works fine, the code is exactly same with yours. I will try to ask our support to send you this file to see it works in your environment.

string fileName = @"..\globe.jp2";
Jpeg2000RasterLayer jp2ImageLayer = new Jpeg2000RasterLayer(fileName);
jp2ImageLayer.UpperThreshold = double.MaxValue;
jp2ImageLayer.LowerThreshold = 0;
 
LayerOverlay imageOverlay = new LayerOverlay();
imageOverlay.Layers.Add("SidImageLayer", jp2ImageLayer);
winformsMap1.Overlays.Add(imageOverlay);
jp2ImageLayer.Open();
winformsMap1.MapUnit = GeographyUnit.Meter;
winformsMap1.CurrentExtent = jp2ImageLayer.GetBoundingBox();
jp2ImageLayer.Close();
 
winformsMap1.Refresh();

 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale

Eric,  
  
 Please check your e-mail for FTP login information to access the sample JP2 image Yale mentions above.

Yale,


I am able to load the JPEG 2000 file that I downloaded from your site.Did you ever get an image downloaded from the site I mentioned? Fact remains that I can display the problem images in ArcMap and Lizardtech GeoViewer, but not in MapSuite Desktop. Not sure where I go from here. Any ideas/suggestions.


Eric



Eric,


 
I am sorry to say that I have no chance to try it out yet, I downloaded a zip file which is 137 MB(Botetourt.zip),while it could not be unzipped. Now I am starting to download the Accomack.zip file which is 1299 MB. Hope I can get it and have a try in a day or two.
 
Thanks.
 
Yale

Just an FYI… we are using lots of JP2 files from the USDA NAIP source.   These run from 50 to 500 mb.   We have found ThinkGeo to work fine on them.   I know that this doesn’t solve the problem for Eric, but wanted to offer a little encouragement.

Ted, 
  
 Thanks for your sharing, I appreciate it very much. I doubt there is some special in the JP2 files downloaded from the website Eric suggested, while it take such a long time to get it down. 
  
 Thanks. 
  
 Yale 


Yale,

Maybe the problem is exactly what you alluded to, the size. The test file you sent me is ~24MB. The files I am dealing with are 1-2GB. What is the largest file you have actually tested with? Is anyone else having this problem with large JP2s? Or could this be exclusive to Windows 7 64 bit. Do you have a Windows 7 64 bit environment to test?  I would really like to know your results once you manage to get one of the files downloaded. Sorry for your download times. They only took me about 45 minutes. What kind of pipe are your working with? Please let me know any progress on your end as I have to upwardly report this on my end. Thanks.


Eric



Eric, 
  
 Let me jump in and answer some of your questions. 
  
 I agree with you that maybe the size is the problem. I am not very sure if we test large file(more than 1GB), I will confirm with our testers. I search our forum, ticket and working tracking system, there is no the same issue with large jp2, most of error is caused by missing DLLs. The issues exclusive to Windows7 are very few, because it is very new OS, not many people use it so far. But we have setup it to clean machine for testing, actually we have all of Windows versions (XP, 2003, 2008, Vista, 7) environment both 32bit and 64bit, before we have major release we test all of them. I think we are in different network area so the download speed is so slow. 
  
 I think Yale can give your results once he gets the files completely.  
  
 Thanks 
 James 


This has finally escalated to an important issue. Need to know the answer, Never heard anything back on the results of loading large JP2000's. Any information is appreciated. Thanks.


Eric



Eric, 
  
 I am sorry to say that it seems we cannot load those large jp2 files. So, if possible, could you contact our support to send us your file? Sorry for the inconvenience for now. 
  
 Thanks. 
  
 Yale