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

Total GRASS noob here. I have several very large hand contoured maps to digitize, and this thread intrigues me. In the past I have spent hours upon hours digitizing these maps and revisions in ArcMap. If I can save myself and my client time and money by using in GRASS, that would be great. The question is, to those with a trained GRASS eye, would even work on a scan like the sample below? I need to get the curved lines out to vectors. I'm wanting some educated eyes on this before I invest the time in learning enough GRASS to get this done. Thanks.

I need to get the curved lines out of this raster

share|improve this question
up vote 8 down vote accepted

Tough one Chad. I suspect not as a first guess. The contours are quite 'light' and the graticule lines are very thick/heavy. You will likely end up with a poor set of results. However, I can run a quick trial for you and let you know!

EDIT: Results of a trial: enter image description here

Works better than I thought, and that was without much initial cleanup. Doing the "GIMP" step (or a similar one in GRASS) would likely help quite a bit with the 'noise' (see bottom corner especially)

The process was:

  • Import your raster into GRASS
  • r.mapcalc outputfile = mask = inputfile != 255 to convert values in to zero and one
  • r.thin on outputfile from above
  • on the thinned raster

Like I said, some initial cleanup would help a lot, and a post vectorization clean (v.clean) would help with dangles, etc.

It may be possible to remove the graticule by calculating 'straightness' of the lines...I recall seeing a method for that somewhere, but can't remember where. Does anyone have any ideas?

Here's another shot with a bit of vector cleanup (remove dangles) applied. Again, it's getting pretty close and with some cleanup before vectorizing, would likely be even better! enter image description here

share|improve this answer
Darren, thanks for the advice and offer to test. I'd be willing to go over the contours with a Sharpie if that would help. Would doing the contours in a color (like red) make a difference I wonder? I'm willing to spend a little time experimenting if there is a chance at getting this to work, as could save lots of time and dollars if it does. Plus I'd love to learn how to do something in GRASS. – Chad Cooper Mar 3 '11 at 15:26
The colour may help, yes. Then when you did your reclassification or cleanup in GIMP, you would be a lot more successful in picking out only what you are interested in. This would save the step of calculating 'straightness' that I mentioned to remove the graticule, and also get rid of the numbers and other random noise. I suggest you install GRASS via OSGEO4W (assuming you are in Windows) and then use it inside QGIS. This, for me, seems to be the most user friendly method. Once you get the hang of it, you can switch to one of the GRASS interfaces, or just run in command line in QGIS as well) – Darren Cope Mar 3 '11 at 16:33
Darren, thanks so much for the testing and thorough explanation of the methodology. – Chad Cooper Mar 4 '11 at 12:22
Not a problem Chad! Let us know how it goes! I did a quick test of on the output, and if you calculate 'sinuosity' you can find the straight lines (the graticule) and then remove them. It was also finding straight sections of contour though, so it perhaps needs a tweak. Possibly the 'azimuth' option would allow you to remove only vertical and horizontal lines, but I have not tried this yet. – Darren Cope Mar 4 '11 at 14:06

Your Answer


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

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