Can an area be quantified from a binary color raster? (how much of is x color)
Hi guys
I've been breaking my head trying to figure out a way to do this.
Essentially I have a DTM/DEM, customer wants to know how much of the land is below 23 degrees (45%) slope, so ive done some shaders and its done, simple enough.
Now he asks if i can tell him EXACTLY how much of that land is below 23 degrees... well it should be a simple matter of counting how many pixels are in total in the raster, then subtracting those that are red (over 23 degrees) and what ever is left in pixels multiplied by the pixel resolution should give the correct answer.
The problem is it does not seem to be as straight forward as that, even when i tell global mapper to do the cut-off areas in a sharp binary matter there's still some "blurriness" caused by the compression around the edges of the red, this throws off the whole math
Is there any better, proper way to do this? I guess someone here should know how
Here's an image of the raster, basically I'm being asked to find out how much of it is black and how much is red
Any help on this would be greatly appreciated.
Comments
-
Ideally getting the areas automatically created as separate vectors so I can just select them and hit analysis/measure and get the total area would be ideal however at this point ill take what ever I can get haha
-
HI @XionicFire
Have you looked at "Create Area Features from Equal Values" under the Layer menu and then selecting black or picking it from your image as shown below?
I've shown the results of my crude attempt below just using a screen clip of your image. Your resolution will be (presumably) much higher.
Hope this helps.
Ta,
/al
-
- Create the two colour shader
- Disable Hill Shading to leave just the two colours (it's the mountain shaped button next to shader name on the main toolbar)
- File > Export > Raster/Image Format
- Import raster
- Right-click the raster layer and choose Layer > Create Area Features from Equal Areas
- Choose All Encountered Color Values
- Right-click on the new vector layer and choose Split
- Choose COLOR from the list
- Right-click on one of the layers then choose Select
- Right-click in the main window then choose Analysis/Measurement > MEASURE
- Note the Total Enclosed Area just above the Export to CSV File button
- Repeat for the other layer
- Use a little maths to calculate the percentages
-
If you enable slope shader new functions are available.
Choose slope shader and then calculate equal area from layer options. Limits then refer to slopes (either degrees or fractions).
Choose low value, like 0.1 for match distance (if you are using degrees). GM create a bunch of new areas. With "search attributes . . . " and query, find and select those areas where "slope" <= your 23 degrees. Voila!
Copy those and paste in new layer.
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 345 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 636 GM Script Language
- 54 User Scripts
- 114 GPS Features
- 417 Projection Questions
- 825 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 178 Announcement and News
- 912 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 569 Other Discussion
- 131 GIS Data Sources
- 27 Global Mapper Showcase
- 238 How I use Global Mapper
- 107 Global Mapper Forum Website