3

Hello I'm an artist trying different ways of drawing contours in QGIS using points with income values. I've been able to import a shp file with the data, create a layer with centroids of the census blocks and create contours using the contours plugin but they're not smooth.

So then I tried creating the contours from an IDW raster but couldn't get the contours to work using extraction->contour.

How can I make the contours using extraction->contour? How can I make them smooth? I'm trying to create a 10 layer contour map of income in NYC which is accurate and smooth. What's the best way to do this in QGIS without GRASS (had issues using it in QGIS) and SAGA (had issues installing on OSX)?

contours

1 Answer 1

3

There are a couple of ways to make your contours smoother.

Looking at the contours, I suspect it's because the IDW raster is low resolution. Did you use the default size (300x300) when creating this?

Resize your IDW raster

Probably the easiest way :-

  • take your existing IDW raster and make it bigger with gdal warp (Raster > Projections > Warp).
  • Choose a larger resolution. I find that changing the raster size to 10x the original size for width and height works well.
  • make sure the 'resampling method' is not 'Near' (I usually use 'Cubic Spline').
  • Extract the contours from the scaled-up IDW raster.

You should now have smoother contours.

Generalizer plug-in

Another thing to check is the 'Generalizer' plugin and apply it to your existing contours. This has several smoothing options, but it is a bit more involved (you'll need to experiment to get good settings)

You might want to check out this question to see how this works.

5
  • Thanks. The contours in that image were created using the contours plugin. When I tried to use extraction->contour it looks like everything pixel has been turned into a vector point. I think I must be missing a step somewhere...
    – jisike
    Jul 25, 2015 at 17:10
  • @jisike: I found the (numpy-) algorithm in this answer most appropriate for smoothing/generalising a raster before deriving contour lines. While I use it for elevation models I don't see why it shouldn't work for any other surfaces.
    – christoph
    Jul 25, 2015 at 17:16
  • thanks, the results look great but I've never used python and just want get the contours working with the idw raster first before smoothing and etc. At the moment
    – jisike
    Jul 25, 2015 at 18:19
  • @jisike - I didn't realise you used the Contours plugin, I've not tried this before. Have you tried using the GDAL contours built into QGIS (Raster > Extraction > Contour)?
    – Steven Kay
    Jul 25, 2015 at 21:09
  • @StevenKay kay yes, but it's not working so I posted another question for it gis.stackexchange.com/questions/155834/…
    – jisike
    Jul 26, 2015 at 16:07

Your Answer

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

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