Sunday 22 September 2019

arcobjects - Using Hillshade option in ArcMap?


Here is a pretty pic of the raster I am using - with no effects applied - just the color ramp and histogram adjusted to show out all the relief - albeit in a very 2D way!


enter image description here



I have a raster layer that I want to display with hillshade as a default. I can do this in code and in effect it is the same as selecting the Hillshade option in ArcMap (see below):


enter image description here


When you do this however - it looks disappointing:


enter image description here


Especially if you zoom into the raster you see all kinds of gridded articfacts - which does not look nice at all!


enter image description here


However if I create a proper Hillshade layer using the raster with Spatial Analyst and overlay it with transparancy of 85% it looks pretty good and very different!:


enter image description here



  1. How can I acheive this effect in ArcMap and override the default functionality of the Hillshade option (I supsect this is impossible, or is it some setting I have missed out that is caused the raster to be displayed poorly). If it is possible to override or select the correct settings - is it possible to do in ArcObjects.


  2. If option 1 is not possible, can I create my effect with creating a Hillshade layer (without using Spatial Analyst) and effectively fuse it to the orginal raster - i.e. I don't want people to see two layers in the table of contents in ArcMap. I just want one layer but with a default hillshade rendering of my choosing/configuration. I need to do this programmatically too i.e ArcObjects.




One thing I have learned is that you must have your DEM in the correct Spatial Reference and measurement units or the resulting hillshade looks too black and over exaggerated - check out this video to find out more - its a very good explanation.


So I think I now know what I need to do in regards to producing some high quality hillshading, but I think it's going to take some low level tweaking ArcObjects code. I am thinking I need to come up with my own graphics rendering and plug this into ArcMap (I have a dll that renders bitmaps of grids in a cool way). I think a good place to show this would be to override the Draw() event on something like the IRasterRenderer, and insert my own image rendering. Of course it might get a bit complicated with reprojections etc.


Has anyone done any kind of this low level graphics rendering in ArcMap - if so can you offer any guidance or things I should be aware of?



Answer



Use Bilinear Interpolation resampling during display


You can somewhat improve the display by changing the resampling method used from the default Nearest Neighbor to Bilinear Interpolation. Layer Properties -> Display Tab -> Resample during display using: Bilinear Interpolation.


This effect works best with DEM and the default black and white color ramp.



You will get a much better result and a lot more control over the display when using 2 raster as you have already done. Make sure you also use the Bilinear Interpolation resampling method during display.


Add DEM:


enter image description here


Toggle "Use Hillshade Effect" on: enter image description here


Renders as follows on screen: enter image description here


Change resampling during display to Bilinear Interpolation: enter image description here


Renders as follows on screen: enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...