Select to view content in your preferred language

JPG/JPEG Raster

181
5
Jump to solution
a week ago
Jeffrey_McNeal
Emerging Contributor
According to https://developers.arcgis.com/net/layers/add-raster-data/ The SDK can handle .jpg and .jpg 2000 formats. When I attempt to load a map .jpg into a Raster Layer, add it to a GroupLayer, and then add GroupLayer to Map.Operational Layers, I receive the error: File error: Failed to open raster dataset: C:\Charleston\Charleston-JPG\charleston.jpg. I am able to create Rasters for RPF (CIB), RPF (CADRG) and GeoTIFFs with no issues.
0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

@Jeffrey_McNeal wrote:

I am not familiar with Gist?

Ah. Sorry. The link I provided in my first reply: https://gist.github.com/nixta/9cf3b53e3340dc3314c6db40af06c709

A "Gist" is just a small snippet hosted on GitHub.

View solution in original post

5 Replies
Nicholas-Furness
Esri Regular Contributor

Are you georeferencing the JPG file properly? Since JPGs have no georeferencing data built in, you need to provide a World file (which defines the size and location of the image) and an Aux file (which defines a spatial reference). See this example: https://gist.github.com/nixta/9cf3b53e3340dc3314c6db40af06c709

If you are already doing that, then can you try to just add the raster layer directly to the operational layers so we can discount Group Layer being an issue?

0 Kudos
Jeffrey_McNeal
Emerging Contributor

@Nicholas-Furness 

Bypassing GroupLayer and adding the RasterLayer directly to Map.OperationalLayer produces the same error.

Also, my user only provided a .jpg file - It sounds like I still need an Auxiliary file and World file to make things work?  Looking in the SDK documentation, I don't see where that gets applied when creating the Raster....

0 Kudos
Nicholas-Furness
Esri Regular Contributor

You just need to place the world and aux files alongside the JPG and the SDK will find them when you create the raster. Think of it this way: in the context of a georeferenced raster, the JPG file alone is incomplete data (hence the SDK error). Complete data is the JPG file + the World file + the Aux file.

Contrast with a GeoTIFF where a single file is complete data for a georeferenced raster.

The error could be better, and we could improve the documentation around the need for world and aux files. I'll pass that on to the team.

For the aux file, you should just be able to copy straight from the Gist. For the world file, you'll need to make sure it's updated to properly position and scale the image. At the bottom of the gist there are links to documentation that describe world and aux files in more detail.

Jeffrey_McNeal
Emerging Contributor

I am not familiar with Gist?

0 Kudos
Nicholas-Furness
Esri Regular Contributor

@Jeffrey_McNeal wrote:

I am not familiar with Gist?

Ah. Sorry. The link I provided in my first reply: https://gist.github.com/nixta/9cf3b53e3340dc3314c6db40af06c709

A "Gist" is just a small snippet hosted on GitHub.