Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

(nb:This project is part of the #Wikipedia #wikimaps project)

1. Question:

  • How to create vector topographic maps from raster image ?
  • How to convert raster topographic image into closed vector polygons for the relevant levels as seen in the illustration below ?

Using commands (likely gdal) and a GIS topographic raster image, I want to produce topographic .shp maps with an elegant relief. This .shp should be made of closed polygons for each of the n requested level.

enter image description here

2. Possible direction would be:

  1. Create vector isolines (gdal_contour -a elev -fl -500 0 500 1000 2000 4000 crop.tif contours.shp)

  2. Create a copy of the whole map area into vector polygon,

  3. Cut this polygon with all isolines of level n (i.e. isolines of level 0).
  4. Keep those of these polygons with a value (altitude) superior to the isoline value.
  5. (merge this polygons into one shp layer of level_n.)
  6. Repeat for each level.

I haven't clues how to do that, but it sound promising! (should work) If you can provide the solution to one of the points 2, 3, 4, It will be really appreciated ! and I will be happy to then open a specific question where I will validate your helpful answer.

3. Current workflow: gdal_contours alone is not suitable. I currently crop my source raster ETOPO using gdal_translate then get levels with gdal_contour. Using the libs curl, unzip, gdal, my current worflow is as follow.

# download it:
curl -o ''
# unzip it:
# crop it:
gdal_translate -projwin -005.48 051.30 10.00 041.00 ETOPO1_Ice_g_geotiff.tif crop.tif
# lines for levels:
gdal_contour -a elev -fl -500 -200 0 100 200 500 1000 2000 4000 crop.tif contours.shp

Unfortunally, gdal_contour generates vertor iso lines, which are not suitable. The main trouble is with cropped areas: in the case of a close up on France, the isolines are not closing into a circle as for Islands or continents but open lines, so there are partial parts of the polygons (as the quarter of a circle) whose' relevant fill --a 1/4 pie-- appear as a filled arc (see bug below).

End result in D3js fails due to unclosed isolines generated by <code>gdal_contour</code>

share|improve this question
An other heuristic could be to: 1. create a copy of the raster area ; 2. delete pixels where elevation < n ; 3. use to generate a .shp layer to later import. See : – Hugolpz Aug 19 '13 at 13:24
This question was answer on SO main website. – Hugolpz Aug 23 '14 at 17:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.