[GRASS-dev] Addons: r.horizon single point mode segfault

Markus Neteler neteler at osgeo.org
Fri Sep 26 02:47:39 EDT 2008


On Fri, Sep 26, 2008 at 3:50 AM, Glynn Clements
<glynn at gclements.plus.com> wrote:
>
> Markus Neteler wrote:
>
>> I tried to use r.horizon in single point mode but it segfaults:
>
>> (gdb) r elevation.dem step=30 direction=15 bufferzone=200
>
> Spearfish?

Yes.

>> coord=-103.75026822,44.43602767
>
> Hmm.
>
>> 1101            z_orig = zp = z[yindex][xindex];
>
>>         xindex = -19662
>>         yindex = -163781
>
>>
>> What could be the problem here?
>
>>         xcoord = -103.75026822
>>         ycoord = 44.436027670000001
>
> This:
>
>  194    stepx = cellhd.ew_res;
>  195    stepy = cellhd.ns_res;
>
>  215    xmin = cellhd.west;
>  216    ymin = cellhd.south;
>
>  461        xmin = new_cellhd.west;
>  462        ymin = new_cellhd.south;
>
> 1073    xindex = (int)((xcoord - xmin) / stepx);
> 1074    yindex = (int)((ycoord - ymin) / stepy);
>
> suggests that coord= is supposed to be cartographic coordinates, but
> coord=-103,44 is way outside of the Spearfish region (~600000,4920000).

Good point. I gave LL coords to the module.

This works:
GRASS 6.4.svn (spearfish60):~ > g.region -c
center easting:  599505.000000
center northing: 4921010.000000
GRASS 6.4.svn (spearfish60):~ > r.horizon elevation.dem step=30
direction=15 bufferzone=200 coord=599505.0,4921010.0

15.000000, 0.408906
45.000000, 0.140486
75.000000, 0.000000
105.000000, 0.000000
135.000000, 0.158644
165.000000, 0.260598
195.000000, 0.303381
225.000000, 0.318726
255.000000, 0.237845
285.000000, 0.276001
315.000000, 0.368949
345.000000, 0.408906

So everything fine here.

thanks
Markus


More information about the grass-dev mailing list