> Agreed (I think you mean '0' is a valid array index).
Yes, I meant '0' :)

> Note this is not quite 'drawing DEM in UTM mode'
OK, thank you for clarifying it.

> basically some fairly obscure USGS Topo files, that I doubt hardly anyone
uses with viking.
What does it mean for the future support of the format in Viking?

Best regards,
Kamil

On Sat, Jan 18, 2020 at 7:51 PM Robert Norris <rw_nor...@hotmail.com> wrote:

>
> > 1. vikdemlayer.c:620
> >
> >Here the code makes sure that array index is not out of bounds, but it
> seems that the condition should be 'if(new < 0)' rather than 'if(new < 1)'.
> '1' is a valid array index.
>
> Agreed (I think you mean '0' is a valid array index).
>
> Thus I also think instead of using
>     prevcolumn = g_ptr_array_index ( dem->columns, x+1);
> explicitly use 0, so its:
>     prevcolumn = g_ptr_array_index ( dem->columns, 0 );
>
> Similarly the upper bound should be explicit, so in a few lines further
> down, instead of:
>     nextcolumn = g_ptr_array_index ( dem->columns, x-1);
> it should be:
>     nextcolumn = g_ptr_array_index ( dem->columns, dem->n_columns-1);
>
> Note that having tried this (as in fixing it to use column 0) there
> appears to be little difference in the end results.
>
> Further note that this is only for the DEM gradient drawing in getting a
> colour by checking the change in elevation values.
> Currently the code suffers from a small edge effect for drawing each DEM
> file, as in working out the colour it only uses the current DEM file; as
> opposed to attempting to get values from the neighbouring DEMs (i.e. the
> elev at a location outside this DEM) to calculate the gradient across the
> boundary.
>
> Depending on how simple this is to fix or if computationally significant,
> I'll at least put a comment in the code about it.
>
> >2. vikdemlayer.c:787
>
> >Here the code draws DEM in UTM mode and is again checking column index,
> and I think that it again is making a mistake. The 'x > 0' condition
> probably should be replaced with 'x >= 0', because '0' is still a valid
> array index.
>
> Agreed it should be 'x >= 0'.
>
> Note this is not quite 'drawing DEM in UTM mode', this is for drawing when
> the DEM data files themselves are in UTM format (as opposed to setting
> Viking to draw in UTM mode). However such DEM files are only available if
> you have configured viking compiling with '--enable-dem24k' and then using
> a separate program 'sdts2dem' - basically some fairly obscure USGS Topo
> files, that I doubt hardly anyone uses with viking.
>
> Indeed having never tried it before, I run the perl script (that Viking
> would invoke) to acquire such DEM files but the website it accesses: "
> geocomm.com" doesn't exist anymore.
>
>
> As ever, thank you for taking the time to analyze and commit on the Viking
> code.
>
_______________________________________________
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/

Reply via email to