I'd like to vectorise the Natural Earth II raster in order to be able to change its colours and display it with as a vector map. Using gdal_polygonize.py won't help as it will create 1 polygon per pixel.

Are there any tools out there able to do the job, ie create polygons by grouping pixels having the same value more or less a threshold?

EDIT: the task it roughly the same as what MapBox guys did to create their vector hillshade, and probably their low zooms landuse.

  • I doubt you'll get good results trying to vectorise it as such - its an RGB map so pretty much continuous values and no two pixels are likely to be the same to make proper polygons. How could you categorise the map to make polygons? Could you load into Photoshop/Gimp and use a colour transformation on the raster?
    – Spacedman
    Sep 17, 2018 at 18:14
  • Yes that's why I'd need a tool to group similar contiguous pixels (like Photoshop's magic wand). In the meantime I'm also polygonizing the USGS landuse, but it's taking ages (been running for 3 days) and it might be too detailed, less than OSM but still too much. Yes I can load the raster into Photoshop / Gimp, but I'm not an expert at it and I don't know how to achieve what I want.
    – Tim Autin
    Sep 18, 2018 at 9:34
  • Perhaps you could categorize the raster date first with for example gdal_calc. Update all pixels within defined ranges to some fixed pixel values and polygonize this classified data.
    – user30184
    Sep 18, 2018 at 14:35

1 Answer 1


I found a solution using USGS landcover dataset and gdal_sieve . The raw dataset looks like this:

enter image description here

And using gdal_sieve led to that:

enter image description here

Which is exactly what I wanted :) . Now I "just" have to choose pretty colours.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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