[GRASS-user] A question before I embark on a programming exercise

Thomas Adams tea3rd at gmail.com
Wed Nov 12 07:37:20 PST 2014


Johannes,

Thank you very much for the useful suggestions. I greatly appreciate your
comments! I'll post my results once I work through things.

Best,

Tom

On Wed, Nov 12, 2014 at 7:42 AM, Johannes Radinger <
johannesradinger at gmail.com> wrote:

> Hi Tom,
>
> what comes into my mind is following approach (not tested):
>
> 1) calculate flow direction using r.watershed for each pixel of your map
> 2) transforming raster to vector points (r.to.vect), adding some columns
> for your results (X, Y, ID). This step should provide you already with
> unique IDs for your cells/points.
> 3) With v.to.db you can update the X  and Y coordinate of your cell center
> and together with the raster resolution you can get the lower left corner
> as desired.
> 3) By knowing the flow direction for each point you should be able to
> calculate the X and Y coordinate of the downstream cell (adding or
> substracting your cell dimensions from the cell center, correct for
> diagonal flow). When you know X and Y of your downstream cell then you
> should be able to also get the ID of the downstream cell (most probably a
> SQL query I guess)
>
> Maybe there are easier ways....
>
> hope it works,
> Johannes
>
> On Wed, Nov 12, 2014 at 5:10 AM, Thomas Adams <tea3rd at gmail.com> wrote:
>
>> All:
>>
>> I need to generate an ascii text file from a flow direction grid that
>> consists of (among a couple other things that don't really matter at this
>> point) for each pixel:
>>
>> (1) a unique integer identifier (1 -- N) for the pixel
>> (2) the integer identifier of the downstream pixel (assuming there is
>> ONLY one)
>> (3) the x,y location of the pixel (presumably, the lower left corner of
>> the pixel)
>>
>> has anyone already done something like this?
>>
>> It's needed (along with some header information) as an input file for a
>> gridded distributed hydrologic model, identifying the flow connectivity
>> from pixel to pixel for streamflow routing purposes. I have already
>> formulated conceptually how to do this, but if someone has already done
>> such a thing, why reinvent the wheel??
>>
>> Any help is appreciated.
>>
>> Regards,
>> Tom
>>
>>
>> _______________________________________________
>> grass-user mailing list
>> grass-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>
>
>


-- 
Thomas E Adams, III
718 McBurney Drive
Lebanon, OH 45036

1 (513) 739-9512 (cell)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20141112/afff434c/attachment.html>


More information about the grass-user mailing list