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'm trying to do a shortest path analysis on my network. In order to prepare the network and attach polygon centroids to the roads, I used GRASS' V.NET operation=connect. the problem with this approach is that instead of connecting points to nearest line, it connect nodes to nearest line OR node which in turn results in unrealistic paths. For example, as you can see in the screen shot, nodes in the central region instead of being connected to the nearest road, are connected to the line that is three time further away.

Is there a way to fix this?

Thanks

P.S. I'm using Grass 6.4 on Mac.

enter image description here

share|improve this question
    
Hi Pey Man. Please mention GRASS version you use and the syntax you have used to receive the result demonstrated by the image. –  dof1985 Apr 1 '13 at 15:33
1  
For vector networking, use GRASS GIS 7 rather than 6 due to many improvements. –  markusN Apr 3 '13 at 16:53
add comment

1 Answer

If I understand your goal and what you mean by "attach" properly, I think you could use GRASS v.distance tool to find the nearest road feature for each point and create line links connecting them. The tool also allows you to upload attributes from the point layer to the line layer. Ostensibly one can do that with more than one attribute field. However I have only been successful in transferring one attribute field at a time (I'm sure I'm just not doing something right). The single attribute field is sufficient if one uses 'category' or other unique ID as the transferred attribute field; one can then join other attributes from the point layer to the line layer using that shared key field.

I was accessing GRASS tools via QGIS 2.2 (not Processing/SEXTANTE plugin, which in spite of its general excellence kept locking up on this task for me). "Pep", you were obviously already loaded up in GRASS, but here's how I went about it, anyway:

-In QGIS, add a field to attribute table that will soon accept unique identifier (ie, 'cat' in GRASS) of nearest feature

-Create new GRASS mapset and import the line and point layers into GRASS with v.in.ogr.qgis

-Run v.distance tool, choosing 'Category of the nearest feature' for "Values describing the relation between two nearest features" and the name of the newly created attribute field for "Attribute field to (over)write"

-If needed, join attribute tables using newly created common key field. I did this back in QGIS after using v.out.ogr to get both points and lines exported back to shapefiles (note: watch the CRS) under the layer Properties > Join tab.

share|improve this answer
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.