At 12:35 PM 2/26/02 -0500, Ned Horning wrote: >how do I define a ridgeline with a DEM as input?
The cells along a ridge line that trends in a given direction, v, have aspects approximately at v + 90 degrees to the right and v - 90 degrees to the left. Thus, one way is to search for all such cells. This can be neatly approximated using the FlowDirection codes returned by ESRI's Spatial Analyst: each code corresponds to a 45 degree window of aspects. The appended script provides the details. The computation is quick. One can also use an aspect grid and even a hillshaded grid to perform similar computations. A nice byproduct of this approach is the resulting grid not only identifies apparent ridge lines, but also indicates their approximate trend direction.
Of course you will not get continuous lines this way. Most ridges bump a little up and down. The down points are saddle points, which within a sufficiently small region are quite flat. Therefore you should expect to see your ridges outlined in a dashed pattern, rather than continuously. The way I have coded it, such lines will be about three cells thick. You can make them thicker or thinner depending on how large a neighborhood you use around each cell.
--Bill Huber www.quantdec.com ' ' Estimates ridgelines in the first active grid theme. ' ' Quantitative Decisions ' 26 Feb 2002 ' theView = av.GetActiveDoc ' ' Obtain the input DEM. ' lThemes = theView.GetActiveThemes if (lThemes.Count = 0) then return NIL end thmDEM = lThemes.Get(0) if (thmDEM.Is(GTheme).Not) then return NIL end gDEM = thmDEM.GetGrid ' ' Find its origin and cell size. ' xCell = gDEM.GetCellSize ptO = gDEM.GetExtent.ReturnOrigin ' ' Compute the flow grid, ' gFlow = gDEM.FlowDirection(false) ' ' Shift flows by one cell in all eight cardinal directions. ' lPtDirections = { -1@0, ' Shift to the West -1@1, ' Northwest 0@1, ' North 1@1, ' Northeast 1@0, ' East 1@(-1),' Southeast 0@(-1),' South -1@(-1)' Southwest } lgShift = {} for each ptIJ in lPtDirections lGShift.Add(gFlow.Shift(ptO + (xCell@xCell * ptIJ), NIL)) end ' ' Compare opposite directions at each cell. ' E.g., the first comparison considers whether the cell to the ' east flows east and the cell to the west flows west. If so, ' a code of j=1 is accumulated into gRidge and this indicates ' the cell looks like part of a north-south ridge line. ' The loop proceeds around the compass in the other three pairs ' of directions, using codes j=2 for NE-SW ridge lines, j=4 for ' E-W, and j=8 for NW-SE. ' gRidge = 0.AsGrid for each i in 0..3 j = 2^i ' Flow direction code gRidge = ((lGShift.Get(i) = j) and (lGShift.Get(i+4) = (16*j))) * j + gRidge end ' ' Display the result. ' thmRidge = GTheme.Make(gRidge) thmRidge.SetName("Ridges for" ++ thmDEM.GetName) theView.AddTheme(thmRidge) ' end of script
To unsubscribe, write to gislist-unsubscribe@geocomm.com ________________________________________________________________________ Setup a GeoCommunity Account and have access to FAST DataDownloads and Premium Career Posting at a discounted rate! https://www.geocomm.com/cgi-bin/accounts/login
On-line Archives available at http://spatialnews.geocomm.com/community/lists/
|