Welcome, Guest. Please login or register.

Login with username, password and session length
Forums Search:  


Author Topic: Converting raster landcover data to shapefiles  (Read 102100 times)

Seldom

  • Expert Advisor
  • *****
  • Posts: 1852
  • Karma: 19
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #15 on: January 18, 2011, 08:41:21 AM »
Boyd,
Have you seen a way to script this yet?  I just posted the question on the GM Yahoo group?

Boyd

  • Expert Advisor
  • *****
  • Posts: 3849
  • Karma: 43
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #16 on: January 18, 2011, 09:42:40 AM »
No I haven't, but Globalmapper scripting is something I just haven't had the time to dabble in at all...

maps4gps

  • Expert Advisor
  • *****
  • Posts: 1524
  • Karma: 17
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #17 on: January 19, 2011, 06:14:42 AM »
Do some testing a use caution.  I found this not to be 100% accurate.  It was not hard to find 'areas' were GM miss classified the polygons.  Anywhere from one or two pixels in size to one area about 1 by 1/4 mile in size.  There was a line around most of these areas but the color in GM was the same (the large area was medium tan bordered by cream, and included dark green and medium red pixels).  Except for processing a very small 'quad' area around this area; the size of the area/quad processed did not seam to matter; even with a very small sized quad/area there were some small miss classified/labeled areas.

Boyd

  • Expert Advisor
  • *****
  • Posts: 3849
  • Karma: 43
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #18 on: January 19, 2011, 06:45:22 AM »
Are you talking about the National Landcover Dataset? There's an interesting article here: https://www.e-education.psu.edu/natureofgeoinfo/c8_p19.html

There's a lot of variation in the colors of each category, and I spent awhile dealing with that when I developed the technique with Mapwel that I described at the beginning of this thread. From the article in the link above:

Quote
The USGS hired private sector vendors to assess the classification accuracy of the NLCD 92 by checking randomly sampled pixels against manually interpreted aerial photographs. Results from the first four completed regions suggested that the likelihood that a given pixel is correctly classified ranges from only 38 to 62 percent. Much of the classification error was found to occur among the Level II classes that make up the various Level I classes, and some classes were much more error-prone than others.

USGS encourages users to aggregate the data into 3 x 3 or 5 x 5 pixel blocks (in other words, to decrease spatial resolution from 30 meters to 90 or 150 meters), or to aggregate the 21 Level II classes into the nine Level I classes. Even in the current era of high-resolution satellite imaging and sophisticated image processing techniques, there is still no cheap and easy way to produce detailed, accurate geographic data.

maps4gps

  • Expert Advisor
  • *****
  • Posts: 1524
  • Karma: 17
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #19 on: January 19, 2011, 07:14:20 AM »
The 2001 NLCD.  For the 2001 data, USGS used different classification algorithms in different areas which were 'tweaked' to give more accurate results in each region; I think the value was 70, or 80 %, but was not able to find the reference yesterday.
Refer to the article you provided the link for.  In the data set provide, each of the classification catagories is assigned and displayed with a specific RGB value.  Three years ago when I check using Photoshop, I found some of the values differed by a number or two (from the values given on a USGS site); however they were consistent.

Boyd

  • Expert Advisor
  • *****
  • Posts: 3849
  • Karma: 43
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #20 on: January 19, 2011, 08:06:39 AM »
I think the 2001 data has a lot of variation in it..... and I just spent many hours staring at it and clicking on individual pixels using the mapwel feature that selects all other pixels of the same value. Off the top of my head, I'd say that each category probably has from 5 to 10 different RGB values. It seems to vary depending on the color of the adjacent pixels. In other words, if a red pixel is next to a green pixel there can be a range of intermediate colors between red and green. But if a red pixel is next to a yellow pixel, there's a different range of colors.

Your experience and analysis may be different though. If you develop your own techniques that work well for this, I will certainly be interested in hearing about them.

Seldom

  • Expert Advisor
  • *****
  • Posts: 1852
  • Karma: 19
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #21 on: January 19, 2011, 12:11:20 PM »
If anyone's interested I've attached a draft script that defines areas, assigns types and attributes, and exports them as shape files, using Mike's Do Loop example.  The syntax of color numbers with leading zeros is fussy.  You need to replace the leading zero with a space, so there are two spaces in front of all 2 digit RGB values.

To make it work you need to use the latest build of GM12.01.
« Last Edit: January 19, 2011, 02:29:14 PM by seldom_sn »

maps4gps

  • Expert Advisor
  • *****
  • Posts: 1524
  • Karma: 17
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #22 on: January 19, 2011, 01:36:09 PM »
FWIW and this may only confuse the issue.

The NLCD data uses a single RGB value for each classification type.
In GM9 the pixels may show a slightly different value depending on the values of the adjacent pixels and may even change values as the tool is moved across a pixel.
In GM12 the values appear to be constant.
In PhotoShop, selecting a polygon with the dropper tool appears to 'flag' all with the same classification.
In MapWell, Boyd reports 'blends' of colors.  I could not remember how to get the RGB value of a pixel.

I conclude that both GM9 and MapWell are changing the pixel values for some reason and the user has no control over this. 
GM12 and PhotoShop are using the RGB values as given in the source data.

Boyd

  • Expert Advisor
  • *****
  • Posts: 3849
  • Karma: 43
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #23 on: January 19, 2011, 03:22:16 PM »
Very interesting.... that could certainly explain it. Will have to take a closer look at that.

Boyd

  • Expert Advisor
  • *****
  • Posts: 3849
  • Karma: 43
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #24 on: January 19, 2011, 04:00:01 PM »
Nope, that isn't it. I can clearly see the variation when I open the file and zoom way in in GM 12.01 - see for yourself in this screenshot. After downloading the area 13 landcover file, I used Globalmapper 11 to crop it to the boundaries of each of my map tiles, then exported that as a 24-bit RGB GeoTIFF. Could something have gone wrong there?


Seldom

  • Expert Advisor
  • *****
  • Posts: 1852
  • Karma: 19
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #25 on: January 19, 2011, 04:01:31 PM »
maps4gps, do you have a link to a site that shows the RGB assignment for each NLCD landcover type?  Right now I'm assigning them by eye, assuming that Dark Green (028,102,051) is Evergreen, etc.

Boyd

  • Expert Advisor
  • *****
  • Posts: 3849
  • Karma: 43
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #26 on: January 19, 2011, 04:13:26 PM »
All I have been able to find is this, and it's a .jpg so I don't think the colors are accurate: http://www.mrlc.gov/downloadfile.php?file=NLCD2001_Colour_Classification_Update.jpg


Seldom

  • Expert Advisor
  • *****
  • Posts: 1852
  • Karma: 19
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #27 on: January 19, 2011, 04:16:25 PM »



Closeup of Cedar City, Utah. No ghosting here, but it sure looks like Boyd has it.  There appear to be 4 red to pink settings:
Light pink: Developed Open Space
Dark pink: Developed Low Intensity
Light red:   Developed Medium Intensity
Dark red:  Developed High Intensity

Seldom

  • Expert Advisor
  • *****
  • Posts: 1852
  • Karma: 19
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #28 on: January 19, 2011, 04:19:51 PM »
All I have been able to find is this, and it's a .jpg so I don't think the colors are accurate: http://www.mrlc.gov/downloadfile.php?file=NLCD2001_Colour_Classification_Update.jpg

That's the basis for my eyeball judgment, but the numbers must be some sort of classification because RGB requires three comma delimited values.

Boyd

  • Expert Advisor
  • *****
  • Posts: 3849
  • Karma: 43
    • View Profile
Re: Converting raster landcover data to shapefiles
« Reply #29 on: January 19, 2011, 04:33:16 PM »
OK, something odd is happening, so I have to check my original downloaded file. If I use the NLCD viewer there's a world of difference. These screenshots don't quite match in coverage and projection, but here's what the viewer looks like:





And this is the same vicinity in Globalmapper:




I'm pretty sure I used the maximum quality in all my imports/exports but maybe I goofed. Or maybe globalmapper is doing some compression?