GM_GenerateWatershed |
Performs a watershed calculation on the loaded terrain layers, generating a stream network and optionally a set of drainage area features for each stream. There is also a way to find ridge lines rather than generating a stream network.
The layer handles returned in aStreamLayer and aDrainageAreaLayer must be closed with GM_CloseLayer when you are done with them.
See the definition of the GM_WatershedParams_t type in the GlobalMapperInterface.h header file for a description of what options are available when generating the watershed. The default options are all a value of zero so you can just pass in a zero'd out structure to get the defaults if you want, but at a minimum you typically do want to setup the mMaxDepressionDepth value unless your terrain has the depressions filled up front. Usually a value of 5 meters or so is good for most data sets.
If you would rather find ridge lines rather than a drainage network, pass in the GM_Watershed_FindRidgeLines flag in the GM_WatershedParams_t.mFlags parameter. The ridge line calculation is the same as a stream calculation on an inverted terrain, so the parameters have basically the same meaning.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GenerateWatershed ( GM_LayerHandle_t32* aLayerList, // IN: List of elevation layers to use or NULL for all uint32 aLayerCount, // IN: Number of layers in list (0 for all) const GM_WatershedParams_t* aWatershedParms, // IN: Parameters for generating watershed GM_LayerHandle_t32* aStreamLayer, // OUT: Created stream layer GM_LayerHandle_t32* aDrainageAreaLayer, // OUT: Created drainage area layer (if created) void* aReserved // IN: Reserved for later use, must be NULL )