Skip to content

Export an elevation profile from a Raster along a Vector line.  #591

Open
@Falawiss

Description

Is your feature request related to a problem? Please describe.
This is not related to a problem, but it is a feature that I have developed for myself after searched for an existing solution in other libraries.

Describe the solution you'd like
I want to trace Line, Polyline or MultiLines on a Vector file. Then import this file (gu.Vector) and export all the encountered values where theses lines cross a Raster. Then we can plot theses profiles along a distance array. See this example :

import matplotlib.pyplot as plt
import geoutils as gu
profiles_axis = gu.Vector('profiles_axis.gpkg')
raster = gu.Raster('raster.tif')

distances, profiles = raster.extract_profile(profiles_axis)

for i in range(len(distances)) : 
    plt.plot(distances[i], profiles[i])
plt.show()

Describe alternatives you've considered
In my project I use start and end points, to select Rasters values over the segment delimited by these two points.

Additional context
An example of the profiles that I have traced on few DEMs along 2 tracks. These two tracks are defined by a starting and ending point, extracted from a gu.Vector file using

profiles_axis_gpkg = gu.Vector('profiles_axis.gpkg')
for line in profiles_axis_gpkg.ds.geometry :
        coords = list(line.coords)

See an example result :
Profils_fortes-pentes_Ossoue

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementFeature improvement or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions