Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I need to vectorize the cell boundaries of a raster map and I have forgotten how to do this.

For instance, if I have a raster map of a region that is just map=1 with a cell size of 500m, I would get a map that shows a grid that is 500m on each side.

Thanks in advance !

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

You can simply make a vector grid with 500m starting at the same coordinate of the raster file. With QGIS you can do this with vector tools -> vector grid. enter image description here

share|improve this answer
    
Exactly what I was going to say! –  Darren Cope Jan 5 '12 at 18:44
    
This is easier and for the English speakers, this would be the command v.mkgrid –  Don Jan 6 '12 at 1:56
add comment

Not the most elegant solution but here is what I did.

1) My raster map in question was actually a MASK where all the cells where all the cells were=1. So I just set my region to the are I wanted my cells outputted and ran

     r.mapcalc myMaskRand = rand(1,1000)

2) Then I just converted that map to vector using

     r.to.vect input=myMaskRand output=myMaskRandV feature=area

3) Then a bit of v.clean and I was good to go.

The only problem is that there were a couple of times that the resulting raster map had duplicate cell values and those cells were lumped. I suppose the best way of ensuring this not happening would be to run

     r.mapcalc myMaskRand = rand(1,1000)*rand(7,77)

or something equivalent.

share|improve this answer
    
That's a good solution. You can expect to have some neighboring cells with the same value, though. A more reliable (and elegant) way is to compute a "checkerboard" pattern of nine alternating values. E.g., one row goes 0120120..., the next goes 3453453..., the next 6786786..., and then you repeat. This is readily done in any raster GIS that supports modular arithmetic and will let you generate grids of row indexes and column indexes: it equals 3*([row] mod 3) + ([col] mod 3). –  whuber Jan 6 '12 at 14:36
add comment

Your Answer

 
discard

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.