GENERATE_CONTOURS function: shader indexing error when generating Iso-height areas

timbottimbot Global Mapper UserPosts: 7
I'm using the following code to generate iso-height areas from a *.bt file:
GENERATE_CONTOURS ELEV_UNITS=FEET INTERVAL=1000 MULT_MINOR=1 MULT_MAJOR=500 GEN_HEIGHT_AREAS=YES INC_UNIT_SUFFIX=NO MIN_CONTOUR_LEN=2000

Using exactly the same shader definition, the shading(area fill) of the resultant iso-height area does not match the shading as applied to the *.bt layer. The iso-height area fill incorrectly looks at the colour defined for the next contour "up".
It looks as though like the GEN_HEIGHT_AREAS function is incorrectly indexing the shader values.
See the picture below that shows the problem:

Thanks, Tim

Best Answer

  • bmg_mikebmg_mike Global Mapper Guru Posts: 173
    Answer ✓
    Tim,

    The issue is that your calculation of the shader levels in meters from the feet value was using a conversion value of 3.2808 hard-coded in the DEFINE_VAR commands. Internally Global Mapper uses 3.2808430145964.

    This discrepancy caused your calculated shader levels in meters to be very slightly higher than they should be, so the area contour heights were just barely below the cut-off in the shader when internally converted from feet to meters using the more exact conversion. Because the shade definition had BLEND_COLORS=NO set, the slight difference caused the lower range to be used rather than the higher range.

    I have fixed this in your script by defining the contour intervals using the following:

    DEFINE_VAR NAME="CVT_FT_TO_MT" VALUE="3.2808430146"
    DEFINE_VAR NAME="CONTOUR1" FORMULA="(%START_CONTOUR_FT% +0) / %CVT_FT_TO_MT%"
    DEFINE_VAR NAME="CONTOUR2" FORMULA="(%START_CONTOUR_FT% +1000) / %CVT_FT_TO_MT%"
    DEFINE_VAR NAME="CONTOUR3" FORMULA="(%START_CONTOUR_FT% +2000) / %CVT_FT_TO_MT%"
    DEFINE_VAR NAME="CONTOUR4" FORMULA="(%START_CONTOUR_FT% +3000) / %CVT_FT_TO_MT%"
    DEFINE_VAR NAME="CONTOUR5" FORMULA="(%START_CONTOUR_FT% +4000) / %CVT_FT_TO_MT%"
    DEFINE_VAR NAME="CONTOUR6" FORMULA="(%START_CONTOUR_FT% +5000) / %CVT_FT_TO_MT%"
    DEFINE_VAR NAME="CONTOUR7" FORMULA="(%START_CONTOUR_FT% +6000) / %CVT_FT_TO_MT%"
    DEFINE_VAR NAME="CONTOUR8" FORMULA="(%START_CONTOUR_FT% +7000) / %CVT_FT_TO_MT%"
    DEFINE_VAR NAME="CONTOUR9" FORMULA="(%START_CONTOUR_FT% +8000) / %CVT_FT_TO_MT%"

    The conversion factor is defined in one place rather than repeated. I used a value that was rounded up at the 10th decimal place rather than use the full exact conversion just in case there is some round-off error somewhere. The very slightly larger value will cause your calculated levels to be very slightly above the GM values rather than below as they are now, causing the proper color to be used.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    http://www.bluemarblegeo.com/
    timbot

Answers

  • timbottimbot Global Mapper User Posts: 7
    That's great Mike, appreciate your help! Thanks for the wonderful support you guys provide.
    Regards
    Tim
Sign In or Register to comment.