Hillshades are often used as an underlay in a map, to make the data appear more 3-Dimensional and thus visually interesting.
![jmap altitude geometry jmap altitude geometry](https://mathbitsnotebook.com/Geometry/Constructions/anglebisectoracute.jpg)
The darker and lighter colors represent the shadows and highlights that you would visually expect to see in a terrain model. A hillshade is a 3D representation of a surface and are generally rendered in greyscale. So the final thing to do is add hillshade to mimic light shining on the topography. While I think this still looks pretty good, it is still 2D and topography is 3D. This corresponds to the gap between the smallest and largest value in the array and is needed when constructing colourmaps later. Also being returned by this function is the value_range variable. The result is that we now have a dataset with no natural gaps in values and the plot is starting to take shape. On the second occasion, the nodata argument is used and the values not part of the Italy polygon are set to be 1 greater than the maximum value in the Italy topography dataset (as calculated with the first mask). You’ll notice that the mask function is called twice, first it is called as above and values not within the Italy polygon are returned as 0’s. In the function below I pass the Italy GeoDataFrame and the rasterio dataset object.
![jmap altitude geometry jmap altitude geometry](https://3.bp.blogspot.com/-Ggen_ymFJYw/V16zmR9iJSI/AAAAAAAAEPw/MuyVBhd3hn8Y3BJWtUS02rMqyBIISJtiwCLcB/s1600/reggcc150122-altitude.png)
I have included a function below which solves this problem. To get around this the mask function allows you explicitly set what value will be applied to values not within the Italy polygon with the nodatakeyword. For example, if the gap between the 0’s and the minimum value is equal to the gap between the minimum and maximum altitude then only half of the colourmap will actually be used on real data. While this is sensible these 0’s will make the plotting tricky because they act as an anchor at the bottom of the colourmap and if there is a large gap between 0 and the minimum elevation value in the Italy data then you get the map seen above, with real data in one half of the colourmap and the other half of the colourmap absent because there is a gap between 0 and the minimum of the real data. By default will fill all values which are not within the Italy polygon with 0. Now we have elevation values corresponding solely to those in Italy however there is still an issue.
![jmap altitude geometry jmap altitude geometry](https://s3.amazonaws.com/walrus-assets/img/Frenchfold-1-735x468.jpg)
Then copy the data to wherever you like to do your programming.
#Jmap altitude geometry download#
It is very simple to download the data, simply click on the tile(s) you want and follow the download instructions. The data is split into 30 x 20 degree tif files which cover different parts of the globe, luckily Italy sits within one of those so we don’t need to worry about combining different tif files, although I will explore such a problem in a future article.
![jmap altitude geometry jmap altitude geometry](https://s3.studylib.net/store/data/008909589_1-ee27966428efbb73f3f4dc38429a04b4-768x994.png)
#Jmap altitude geometry free#
The data is free to use and further information on the data usage can be found at the following link. So going forward we will be using the higher resolution data which comes from the USGS (1). While they may not seem all that different, the image on the left uses much higher resolution data (1) compared to the image on the right (2) and hence areas that are relatively flat, for example the Po valley in northern Italy appears much hillier than it actually is in the image on the right. Topography of Italy plotted using a high resolution (7.5 arc seconds) and a low resolution (1 arc minute) data source.