User:Ff5722/USGS treecover data

From OpenStreetMap Wiki
Jump to: navigation, search

Here I will describe how to use USGS treecover data for OSM.

Prerequisites

  • A somewhat recent non-low power CPU is recommended as well as 8 GB of RAM (I used a Pentium G4560 with 8 GB of RAM and waiting time was in the order of seconds)
  • QGIS (free download)
  • JOSM with the Opendata plugin and utilsplugin2
  • Several GB of free disk space

Workflow

www.youtube.com/watch?v=zTSIxVxPrMc

Downloading data

  • Download a 'tile' that includes the area you are interested in. The coordinate in the filename indicates the top left corner of the tile, so the file with name '10N 50E' stretches from (10N,50E) to (00N,60E). Extract the archive, the data is buried in all the folders.

QGIS data processing

  • Open the tile in QGIS by choosing 'Layer > Add Layer > Add Raster Layer' and select the GeoTIFF
  • You need to crop the tile, otherwise the vectorization will take ages
  • Choose 'Raster > Extraction > Clipper'
  • Either using the mouse, or the coordinate entry screen, select a crop area of around 1 by 1 degree lat/lon
  • Choose an output file name and press OK (the extension should be *.shp 'wiki:shapefile
  • Now you're ready to generate the contours
  • 'Raster > Extraction > Contour'
  • Make sure you select the correct input file (your cropped file)
  • Select an output file name
  • I recommend choosing a different interval than the default (10). For this data, the values it can have are between 0 and 100. So, if you set the interval to 50, you will have one contour level (50), for 25 you will have 3 (25, 50 and 75), for 10 you will have 9 (10, 20, 30, 40, 50, 60, 70, 80, 90). Try 50 for now. If you see you are missing a lot of forest area, you can adjust the contour level later.
  • Especially if you use a contour level higher than 50, then turn on the attribute name, so that you can later filter on one contour level. (they will receive a tag 'ELEV=50.0' for example)
  • Select OK. If you chose the cropped tile size mentioned above, the contours will be finished in a few seconds at most. If it takes long to finish, close the window and go back to crop a smaller area.

Simplification

You can either simplify ways in JOSM or in QGIS. the methods differ a little, but JOSM is much slower. To simplify in QGIS, in the top menu bar, select Vector > Geometry tools > Simplify geometries. For Tolerance I found that a value of 0.0001 keeps enough details while still reducing the number of nodes significantly. Once finished, save the simplified layer as a shapefile.

Existing data

  • Check on OSM that there is no conflicting/existing data on the OSM server for the area you processed
  • If you don't know for sure, then stop here and don't add data for this area
  • If you still want to continue, download the existing data that is relevant (landuse=forest, natural=wood, etc.)
  • Continue with the next steps and prevent overlapping of existing and imported data. Always prefer existing data if you are not sure! It's better to import less than available than to import too much.

JOSM import

  • Drag the *.shp file into your JOSM window
  • The window should be centered at your geocoded data
  • If you haven't done so yet, turn on an image layer (e.g. Bing)

Data cleanup

  • Compare with the satellite imagery so see if the contours need adjusting or not.
  • If you have exported multiple levels, then check which level suits best.
  • Remove the small forest areas, they are too rough anyway, and complicate creating the multipolygons. To do so, use the search string 'nodes:1-8' to select all ways with up to 8 nodes. Press delete to remove them. Note: deleting more than ~1000 ways at once can cause JOSM to freeze.
  • Simplify ways (select all, then press SHIFT+Y), this can also be done in QGIS, but then you will have to adjust the parameters first. Note: simplifying more than ~1000 ways may take a long time or cause JOSM to freeze.
  • Close up the unclosed ways at the boundaries of your domain, or remove them. It's convenient to use the validator to find unclosed ways.
  • Select the inner ways 'Selection > All inside' (ALT+SHIFT+I) and create multipolygons, note that you can have islands within islands, which should be tagged as 'outer' again. It's convenient to let the JOSM validator check this and repair it only before uploading.

Post-processing

  • Add the appropriate tag(s) to the contours you want to import (e.g. natural=wood, source=USGS treecover2010))
  • Remove any data that shouldn't be uploaded
  • Remove tags that don't belong in OSM (e.g. ID, ELEV)
  • Run the JOSM validator and solve any warnings or errors
  • If the number of objects is higher than 10,000, you will need more than one changeset. Select upload, then in the upload confirmation, choose the 'Advanced' tab and set the number of objects per changeset (use 10000 if you have a stable internet connection) and upload (the default is uploading 1 object at once...)