The height of the terrain (scene units, above the body's sphere or
ellipsoid) at latitude and longitude lat, lon (degrees), from the
last elevation layer added that is a file (LAYER_GDAL), read directly
(also before the body is shown); found is false (and the height 0)
without such a layer or data there, or without Rocky.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(TerrainBody), | intent(in) | :: | self | |||
| real(kind=wp), | intent(in) | :: | lat |
latitude and longitude (degrees) |
||
| real(kind=wp), | intent(in) | :: | lon |
latitude and longitude (degrees) |
||
| logical, | intent(out), | optional | :: | found |
false if there is no height there |
function elevation(self, lat, lon, found) result(h) class(TerrainBody), intent(in) :: self real(wp), intent(in) :: lat, lon !! latitude and longitude (degrees) logical, intent(out), optional :: found !! false if there is no height there real(wp) :: h character(len=:), allocatable :: file integer(c_int) :: ok integer :: k h = 0.0_wp if (present(found)) found = .false. if (.not. rocky_available()) return do k = self%n_layers, 1, -1 if (.not. (self%layers(k)%elevation .and. self%layers(k)%source == LAYER_GDAL)) cycle file = self%layers(k)%uri if (index(file, '://') == 0) file = find_data_file(file) if (len(file) == 0) return h = vkf_rocky_elevation(file, len(file, kind=c_int), self%profile_, len(self%profile_, kind=c_int), & real(lat, c_double), real(lon, c_double), ok) * self%units_per_meter_ if (present(found)) found = ok /= 0 return end do end function elevation