2

I have a DEM raster file of a country. From this, I want to produce a polygon shapefile which only contains the land boundaries of the country.

My idea is to select the parts of the raster which have values greater than 0 (therefore, selecting only the land part, and excluding the LAKES and OCEANS).

The problem is how to convert this to a polygon, with all the inner lakes and the ocean excluded?

I have tried Raster>Polygonize, but I don't really want this, just the boundary of the country excluding the water bodies.

  • you could clip the raster and then proceed to polygonize your raster – DirkB. Dec 19 '16 at 17:42
  • 1
    Your first step would be identifying the lakes. Do you have a feature class of water bodies for your area of interest? – Tom Dec 19 '16 at 17:57
  • 2
    Step 1. Reclassify the raster ( 1 = dem value >0, 0 = all other values) Step 2. Convert Raster to polygon Step 3. Erase all polygon fields that are not 1 Step 4. You may want to run a dissolve to clean up your dataset **I am unsure of the specific tools in QGIS so I did not post this as an answer. Hope this helps. – user52640 Dec 19 '16 at 19:33
  • 2
    lakes are usually higher than 0. What is the source of your DEM ? – radouxju Dec 19 '16 at 20:06
  • I might be stating the obvious here, but have you checked to see if the data you're trying to create already exists? Bodies of water and country borders are pretty basic info. – csk Dec 19 '16 at 21:01
1
  1. Set all your negative value into nodata first: How to set all pixels with value <= 0 to "nodata" in DEM raster?

  2. Use raster calculator to multiply your resulting raster by 0, that way you can get a raster with just 2 kinds of value: 0 and nodata

  3. Polygonize the resulting raster from step 2, you should get one polygon indicating the 0, which is the boundary. If you find topology error, use dissolve. You can try the QGIS dissolve tool, if you still cannot get one polygon, use v:dissolve on the dissolved polygon.

  • Why not just use the Con tool in place of steps 1 and 2? And what about the lakes? – Tom Dec 19 '16 at 22:09
  • Is there a simple con tool in QGIS? this one is quite complicated: gis.stackexchange.com/questions/69734/…. And according to John the lake is <0 so they are nodata after step 1, they should not appear in the polygon – chenghopan Dec 19 '16 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.