Hillshade coming out totally wrong

7588
6
Jump to solution
02-21-2012 11:49 AM
grahamlangley-edwards
New Contributor II
Hello, I have a DEM of Spain that I mosaicked together using the Mosaic to new raster tool.  When I try to create a hillshade, it comes out very grainy and inaccurate.  For example, the max height is listed as 254 meters, which is about 2000 meters off.  Also the hillshade itself does not look right, it appears very grainy and small.  I have attached a screenshot of the hillshade.  I feel like it has something to do with the Z-factor field in the hillshade dialog, but I have no idea what to set that to so I leave it as the default value of 1.  Any help would be appreciated.

Thanks
0 Kudos
1 Solution

Accepted Solutions
EricRice
Esri Regular Contributor
Hi Graham,

Thanks for the info. It's very helpful, and we'll get you situated in no time at all.  First though, I'd like to point you to some more reading.

Why does my hillshade look different when I use a tool vs. a function?

Given the information in the link, and the extent at which you want the hillshade to look good (zoomed out), I am going to recommend you use the Mosaic Dataset option and work with the Hillshade Function, rather than the Hillshade GP tool.  We already know the tool result looks good when zoomed in.  The display at smaller scales is less appealing because the Hillshade tool is applied at the source pixel size of the data, then resampled when you zoom out.  For this reason, the Mosaic Dataset is better because the Hillshade function is applied at the scale in which you are viewing the imagery, first resampling the DEM to that resolution before applying the hillshade effect.

Forget the mosaic's you've created so far and only work with the original source tiles in WGS_1984.  I assume you are working with 90m SRTM data given your cell size of  0.00083333333.  Your X,Y units are therefore Decimal Degrees.  The Z unit I asked about was asking what units the elevation values were in.  I'll assume elevation is expressed in meters.

Workflow:

Create a geodatabase and a mosaic dataset.  When you create the MD, set the coordinate system to ED_1950_UTM_Zone_30N or WGS_1984_UTM_Zone_30N if you want to avoid setting a geographic transformation later.  Use ED_1950 if you require it.  By setting the coordinate system of the MD to something that uses meters for X and Y units, you are assuring that X,Y,Z are all in meters, simplifying the Z factor decision later. You'll just use a value of 1.

Run Add Rasters to Mosaic Dataset tool.  Use Raster Dataset for the Raster Type parameter.  Point to the original data or the workspace where they all reside - your choice.  Load the data with UNC paths rather than C:\ or some other mapped drive letter if you plan on others accessing the data.  Check the box to "Update Overviews".  This is how you avoid seeing the gray box at small scales.  If the Mosaic Dataset is lacking statistics at this point, do not bother building them because they will only be invalidated after applying the function.

Add Hillshade function

  1. In the Catalog window, right click the MD and click Properties.

  2. Click the Functions tab.

  3. Right-click the Mosaic Function and click Insert > Hillshade Function.

  4. Adjust parameters to your liking.  Z factor should be 1.

  5. Click the Defaults tab when you're done with the Functions tab. 

  6. Set the Default Resampling Method to Bilinear Interpolation.

  7. Also on the Defaults tab you can set the Geographic Coordinate System Transformation if you do use ED_1950.

The statistics of the mosaic dataset are invalid since the original statistics were calculated on the elevation data (signed 16 bit data) and the hillshade is producing a 8-bit image.

The last step is to recalculate the stats.  In the Catalog window, right-click the mosaic dataset and click Calculate Statistics.  When calculating the statistics for the mosaic dataset, you do not need to calculate them for every pixel. It is highly recommended you specify a skip factor. A simple equation is the number of columns divided by 1,000.  If you don't specify a skip factor, this process could take a very long time.

View the mosaic dataset in ArcMap and let me know what you think at varying scales.

Regards,
Eric

View solution in original post

0 Kudos
6 Replies
MelitaKennedy
Esri Notable Contributor
Here's a blog entry about it:

Setting the z factor parameter correctly

Melita
0 Kudos
grahamlangley-edwards
New Contributor II
Thanks, Melita, for your help.  I used the project raster tool to define the linear units, but the hillshade comes out the same.  I also tried to use the correct z value on the original DEM that I had not used the project raster tool on, and get just a solid color without any hillshade.  I tried every combination of feet or meters for the z value, and tried using z values with the reprojected DEM as well, but I just keep getting a solid color with no texture.  Not really sure what to do at this point, any suggestions??

Thanks again,

Graham
0 Kudos
EricRice
Esri Regular Contributor
Hi Graham,

The hillshade you first displayed in this thread looks fine I bet when you zoom in.  True?  You definitely have pryamids built on that one and maybe displaying it with nearest neighbor resampling (or even had pyramids constructed that way). Did you try deleting the pyramids and checking the display again?

If we can back up for a moment we should be able to get this sorted out.  What is the coordinate system of the orginal data you had, and what is the unit of the pixel (z unit) data?  You want X,Y,Z to all be the same for this to work out nicely.  After mosaicing the smaller tiles, did you project it?  Or was the target mosaic a different coordinate system than the source tiles?  How did you mosaic it basically?

Projecting raster data defaults to Nearest resampling as well, so for elevation data this would be bad. You want bilinear.  Also, what is your license level?  I personally would just use a Mosaic Dataset in 10.0 and apply the hillshade function on the fly, rather than having to store on disk the DEM data plus a derived hillshade dataset.  See Managing Elevation Data

A hillshade result is 8 bit unsigned data.  It can't possibly go to something like 2000+.  Further, the hillshades values are not indicative of elevation as you seem to indicate should be the case.  Hillshade is simply returning illumination values.  The documentation indicates the valid output range is 0-255. 

Regards,
Eric
0 Kudos
grahamlangley-edwards
New Contributor II
Hi Eric, thanks for your reply.  The hillshade does look fine if I zoom in, however, pyramids are listed as absent under Raster Information in the hillshade's Source tab, and a resampling method is not indicated.

I mosaicked the original DEM layer through the Mosaic to New Raster tool, importing the spatial reference from the original DEM's.  The spatial reference was originally in WGS_1984, while the data frame was in ED_1950_UTM_Zone_30N, so I used the Project Raster tool to reproject the mosaicked DEM's into ED_1950_UTM_Zone_30N.  I'm not sure what you mean by "unit of the pixel (z unit) data".  The cell size (X,Y) is 0.00083333333, 0.00083333333.  Pixel type - signed integer, pixel depth - 16 bit, pyramids are level 5; nearest neighbor, if that helps.

I tried to mosaic through the Mosaic Dataset tool, I created the geodatabase and added the layers using the Add Rasters to Mosaic Dataset tool, but the output was just solid gray.  I got around this last time by changing the stretch to percent clip, but when I try to do that this time, it would not let me compute the histograms and nothing changed.  Also, I did go into the mosaic dataset properties after I created the dataset and transformed the geographic coordinate system, like it says in the ArcGIS help window about Create Mosaic Datasets, so I think that should be all good.  Hopefully there is a way around this.

Thank you for all your help, I really appreciate it,

Graham
0 Kudos
EricRice
Esri Regular Contributor
Hi Graham,

Thanks for the info. It's very helpful, and we'll get you situated in no time at all.  First though, I'd like to point you to some more reading.

Why does my hillshade look different when I use a tool vs. a function?

Given the information in the link, and the extent at which you want the hillshade to look good (zoomed out), I am going to recommend you use the Mosaic Dataset option and work with the Hillshade Function, rather than the Hillshade GP tool.  We already know the tool result looks good when zoomed in.  The display at smaller scales is less appealing because the Hillshade tool is applied at the source pixel size of the data, then resampled when you zoom out.  For this reason, the Mosaic Dataset is better because the Hillshade function is applied at the scale in which you are viewing the imagery, first resampling the DEM to that resolution before applying the hillshade effect.

Forget the mosaic's you've created so far and only work with the original source tiles in WGS_1984.  I assume you are working with 90m SRTM data given your cell size of  0.00083333333.  Your X,Y units are therefore Decimal Degrees.  The Z unit I asked about was asking what units the elevation values were in.  I'll assume elevation is expressed in meters.

Workflow:

Create a geodatabase and a mosaic dataset.  When you create the MD, set the coordinate system to ED_1950_UTM_Zone_30N or WGS_1984_UTM_Zone_30N if you want to avoid setting a geographic transformation later.  Use ED_1950 if you require it.  By setting the coordinate system of the MD to something that uses meters for X and Y units, you are assuring that X,Y,Z are all in meters, simplifying the Z factor decision later. You'll just use a value of 1.

Run Add Rasters to Mosaic Dataset tool.  Use Raster Dataset for the Raster Type parameter.  Point to the original data or the workspace where they all reside - your choice.  Load the data with UNC paths rather than C:\ or some other mapped drive letter if you plan on others accessing the data.  Check the box to "Update Overviews".  This is how you avoid seeing the gray box at small scales.  If the Mosaic Dataset is lacking statistics at this point, do not bother building them because they will only be invalidated after applying the function.

Add Hillshade function

  1. In the Catalog window, right click the MD and click Properties.

  2. Click the Functions tab.

  3. Right-click the Mosaic Function and click Insert > Hillshade Function.

  4. Adjust parameters to your liking.  Z factor should be 1.

  5. Click the Defaults tab when you're done with the Functions tab. 

  6. Set the Default Resampling Method to Bilinear Interpolation.

  7. Also on the Defaults tab you can set the Geographic Coordinate System Transformation if you do use ED_1950.

The statistics of the mosaic dataset are invalid since the original statistics were calculated on the elevation data (signed 16 bit data) and the hillshade is producing a 8-bit image.

The last step is to recalculate the stats.  In the Catalog window, right-click the mosaic dataset and click Calculate Statistics.  When calculating the statistics for the mosaic dataset, you do not need to calculate them for every pixel. It is highly recommended you specify a skip factor. A simple equation is the number of columns divided by 1,000.  If you don't specify a skip factor, this process could take a very long time.

View the mosaic dataset in ArcMap and let me know what you think at varying scales.

Regards,
Eric
0 Kudos
grahamlangley-edwards
New Contributor II
Eric,

     That worked perfectly, and looks great at all scales.  Thanks for the detailed workflow, and for all your help. 



Regards,

Graham
0 Kudos