Raster without spatial reference

581
3
Jump to solution
09-03-2020 01:46 AM
YaronAvraham
New Contributor III

Hi,

I need to load local raster file without any geo coordinates, i was able to load the file as raster layer and i see it at maps 0,0.

but the spacial reference is empty, can i somehow at runtime add spatial reference to the layer? 

is there any other way to load raster file without spatial reference and show it on a map with spatial reference?

any advice would be apriciated even if its not a trivial or official solution

Thanks!

0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

You'll need a couple of files to go with the local raster file. Some local raster formats embed this in the headers, but some need an accompanying file or two.

One file specifies the spatial reference. This is a .aux.xml file. See this gist for an example.

The other file specifies pixel to coordinate mapping. This is called the world file and you can read more about world files here, including what to name them. These are plain ASCII files with 6 values in that describe how a pixel in the image translates to a geographic coordinate:

  • x-scale and y-scale for the pixels
  • x and y offsets for the center of the upper-left pixel from the spatial reference origin.
  • Two rotation terms (frequently those are 0).

The scale and offsets are in the spatial reference units of the spatial reference declared in the .aux.xml file.

Some people have successfully created these files on the fly in their Runtime apps, written them to disk alongside the image, and opened the image as a local raster. You probably don't need to ever modify the .aux.xml world file (the one in the gist is for Web Mercator Aux Sphere) and can just reuse it.

Hope this helps.

View solution in original post

3 Replies
Nicholas-Furness
Esri Regular Contributor

You'll need a couple of files to go with the local raster file. Some local raster formats embed this in the headers, but some need an accompanying file or two.

One file specifies the spatial reference. This is a .aux.xml file. See this gist for an example.

The other file specifies pixel to coordinate mapping. This is called the world file and you can read more about world files here, including what to name them. These are plain ASCII files with 6 values in that describe how a pixel in the image translates to a geographic coordinate:

  • x-scale and y-scale for the pixels
  • x and y offsets for the center of the upper-left pixel from the spatial reference origin.
  • Two rotation terms (frequently those are 0).

The scale and offsets are in the spatial reference units of the spatial reference declared in the .aux.xml file.

Some people have successfully created these files on the fly in their Runtime apps, written them to disk alongside the image, and opened the image as a local raster. You probably don't need to ever modify the .aux.xml world file (the one in the gist is for Web Mercator Aux Sphere) and can just reuse it.

Hope this helps.

YaronAvraham
New Contributor III

Many thanks!

only by adding the aux.xml file it solved my problem and added spatial reference, i dont want to show the raster file on real world map, i need it to be a stand alone layer but have spatial reference so i could project graphics on it.

Thanks again!

hesapadam
New Contributor III

How can I create aux.xml file on the fly in ArcGIS Runtime?

0 Kudos