GENERATE_CONTOURS function: shader indexing error when generating Iso-height areas
timbot
Global Mapper User
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
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
Answers
-
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/ -
That's great Mike, appreciate your help! Thanks for the wonderful support you guys provide.
Regards
Tim
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website