I'm using GRASS 7.0.4 under Linuxmint 17.1 KDE.
I need to build a raster with the shortest distance from every pixel to a city following a road. I have two shape files, the city (point) and the road (line). I plan to compute these distances in two steps, first the straight-line distance from the pixel to the road and second the distance from there to the city following the road.
My idea is to build a point grid, compute the distances from each point of the grid to the city and transform this grid to a raster file (May be you have a better idea, could I use r.grow.distance
to do this?)
So, I've built the grid with points every 500 m.
First, I've tried to solve the problem with v.distance
with the to_along
parameter. The problem here is that the road continues after the city so I don't know how to compute the distance up to the city and not all along the road. And I cannot clip the line representing the road because I have points to the south and to the north of the city.
After that, I've used the output
parameter of v.distance
to build a vector containing the lines connecting every point in the grid to the road. I've merged this new vector with the road and obtained a network connecting all the points in the grid with the city (I think that probably here is my problem).
Then I did the following:
v.net -s input=net_clean points=grid_500 output=net1 operation=connect threshold=400 arc_layer=1 node_layer=2
v.net input=net1 points=City output=net2 operation=connect threshold=400 arc_layer=1 node_layer=3
Up to this step, everything goes fine, but when I try to compute distances:
v.net.distance input=net2 output=distances_1 from_layer=2 to_layer=3
I obtain the following message:
WARNING: 30 'from' features were not reachable
And this is doing a test with only 500 points in the grid, my original grid have almost 80,000.
I've tried with v.clean
as suggested here: http://www.webrian.ch/2011/06/routing-with-openstreetmap-data-in.html and here: How to fix unreachable nodes in QGIS GRASS network?.
That reduced the original number of "not reachable" features from 117 to 30. But I still don't know how to completely solve the problem.
If you know of another tool to solve the problem, as long as it is free, I'll be glad to try it.
Any suggestion?
threshold
value? – Lucas Jun 8 '16 at 11:50threshold
does, but the manual isn't very helpful! – MikeRSpencer Jun 8 '16 at 11:51