I've been searching for examples on how to create a RasterLayer from *.JP2 files but haven't found any.
I had no problems adding the jp2 file in ArcMap 10.3 but when I try to add it as an rasterLayer i get SpatialReference = null;
I have had no problems with other file formats iv'e tried.
Heres my code
Raster inRaster = new Raster(myFileSource);
RasterLayer newRasterLayer = new RasterLayer(inRaster);
I tested with a JPEG 2000 image I found here, and had no problems displaying the raster layer in an ArcGIS Runtime (WPF) app. A *.JP2 file stores spatial reference info directly in the file using Geography Markup Language (GML). If you open it in a text editor (Notepad++, e.g.), you should see info like this:
Can you confirm that your image has coordinate system info defined? It might be that ArcMap handles the missing spatial reference by simply assigning a default (?).
I tried the JP2 you linked to and had no problems displaying the raster layer in my ArcGIS Runtime app.
So I inspected both JP2 files in Notepad++ and my JP2 file does not have the ProjectedCRS tag.
However my FeatureCollection does contain some informatorn about the spatial reference.
Here's where the info about spatial reference is stored in my JP2
<gml:offsetVector srsName="urn:ogc:def:crs:EPSG::32755">0.500000000000000 0</gml:offsetVector>
<gml:offsetVector srsName="urn:ogc:def:crs:EPSG::32755">0 -0.500000000000000</gml:offsetVector>
I ran this past someone more knowledgeable with using raster in the runtime, and they suspect it might be a bug. We'll investigate further and try to find a resolution. In the meantime, would it be possible to share one of the images that gives you the problem? If so, you can contact me directly at email@example.com. If the file zips smaller than 20 megs or so, feel free to simply attach it to an email. Otherwise, we can arrange another way to share it.
Thank you for your response.
Sadly I'm not sure its possible for me to share the images.
Even do I know that it probably will make it more difficult to solve.
Please tell me if there something else I can do to help.