How do I count the number of vector lines that pass though a given raster cell?

المشرف العام

Administrator
طاقم الإدارة
I am working on a project (currently in GRASS7 though I'm not against exporting to Arc or R or other software if necessary) where I am generating thousands of shortest cost paths (using the r.walk and r.drain modules) to various points around my map of Papua New Guinea. What I am interested in is figuring out how to take the generated vector lines and create a raster that counts the number of lines that pass through each cell of that raster. This will give me an estimate of which locations on the island are most likely to be located on a shortest path from one point to another.

One way to do it would be to (using python)1. Create a raster initalized to 02. use a python script to run though and rasterize each line individually and 3. add each line to the raster using raster calculator to create a count.

The problem with this approach is that for the tens or even hundreds of thousands of lines I'm using, it takes a very very long time. I would like a way to directly count the number of lines. Something like http://grasswiki.osgeo.org/wiki/Count_points_in_raster_cellsexcept with lines.

I'm stumped, so if you have any creative thoughts, thanks in advance!



أكثر...
 
أعلى