Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm working with shapefiles representing rivers (rivers.shp), and DEM for the terrain elevation (terrain.tif).

Basically, I want to check that my rivers (stored as polylines in my shapefile) behave like "natural" water flow, meaning that it mainly go downstream, can not go uphill first and downhill then, etc...

I'm using GDAL/OGR in Python, and don't really see how to proceed. Should I extract the points of the polylines in the shp? Look for the elevation at those points in the DEM, and then compute my decision?


share|improve this question
Unless the polylines were derived from the DEM or the DEM was created using those polylines, there are certain to be such discrepancies. What actions will you take when you find them? Do you plan to change the DEM, change the polylines, both, or neither? This partially determines good ways to make the comparisons. BTW, some potential solution methods are given in answers at gis.stackexchange.com/questions/8685/…. –  whuber Apr 24 '13 at 14:46
Polylines reprensenting the rivers are not necessarily derived from the elevation. Sometimes rivers may be computed from the elevation, but I will deal with all cases. I don't need to change the polylines, just give an answer to the user (i.e. nb of wrong polylines). You'd say feasible in GDAL/OGR Python? –  eouti Apr 24 '13 at 17:41
I agree w/ @whuber, that if the watercourses were derived from different data (i.e. different resolution DEM such as 90, 30, 10-meter, or traced by a person looking at an aerial image), you'll have to run it through several programmatic filters (like snapping in-stream points to the lowest-elevation grid cells given an established radius?) to even be close to a fair comparison. ..and if your rivers data has been simplified, you can expect little, if any, agreement between the data. –  elrobis Apr 24 '13 at 19:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.