I'm trying to scan plain pdf maps containing color-coded geographic regions and convert them into undifferentiated (I don't actually need them to contain any attribute data) overlays. My workflow is to take one of my color-coded maps, select a few of the color-coded regions via Gimp's "Select by Color" tool, cut those out into a separate layer, then export just that layer with a transparent background as a tiff. I then georeference that tiff, and proceed to polygonize it. Polygonization of poor quality images is causing what should be 100-1000 polygons (map regions) into 1 million polygons, most of which are 1-4 pixels in size (area).

So far a solution hasn't been forthcoming. So on the GIS front, I'm hoping I can at least merge directly adjacent polygons. Here's what they look like:


In QGis, I've tried the "dissolve" tool, the "buffer tool" & the "Multipart(s) to singlepart(s)" tools, as well as the "Densify" tool & and "Simplify" tool.

None have really worked so far. The buffer tool, which has worked in the past, turns the entire area into a single polygon, even when I try to get it to approximate the maximum (99) number of segments. Other methods either do nothing, fill the entire screen with a single polygon, or take literally days to process.

So maybe there is a "Polygonize" method (from raster) that will best do the job here, or maybe its a post-polygonize job. Thanks for taking a look

  • 2
    It is hard to provide a solution without knowing your workflow. I suspect you are using polygonize with a field containing unique numbers. Consider reclassifying your raster dataset so that all of the polygons are created based on a field name containing only a single integer.
    – Aaron
    Jan 23, 2014 at 15:49
  • 1
    I am hoping you can edit this question to address some of its ambiguities. First, it's not entirely clear what you mean by "polygon map" or "segment." Your example, which lacks a legend or description, does not resolve this vagueness. Your list of attempted solutions further muddies the waters because they do distinctly different things. How, precisely, does your image represent polygons? Are there polygons of multiple types distinguished by substantially different colors or not? Is each connected component of these polygons supposed to be output as a distinct feature or not?
    – whuber
    Jan 23, 2014 at 18:19

2 Answers 2


For your problem, I would suggest you to use some image segmentation tools. Several of those tools are available in OTB, available as stand alone tools or as a QGIS plugin through Sextante. You would be in the case of "region growing"

  • Region-growing algorithms are what I need. Implementation much more difficult than I had hoped due to the complexity of the options. Interesting learning this stuff with medical imagery examples Mar 6, 2014 at 14:33

The pixels selected via Gimp's "Select by Color" tool are probably actually slightly different values. The polygonize tool will convert each separate group of pixels with exactly the same value to a separate polygon

After you select the pixels in GIMP, use the bucket tool to fill the entire selection with a single colour.

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.