<html style="direction: ltr;">
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
  </head>
  <body style="direction: ltr;"
    bidimailui-detected-decoding-type="latin-charset" text="#000000"
    bgcolor="#FFFFFF">
    Hi john<br>
    <br>
    <div class="moz-cite-prefix">On 28-Jun-14 11:39 PM, John Harrop
      wrote:<br>
    </div>
    <blockquote cite="mid:1403987947674-5148578.post@n6.nabble.com"
      type="cite">
      <pre wrap="">I'm new to QGIS (on Mac OS X) but have been enjoying learning and using it. 
One of the methods I'm trying to track down on QGIS is transferring polygon
attributes to adjacent lines.  The context is geological and the polygons
represent rock units and their associated properties.  The lines (geological
contacts) are derived from the common edges of the polygons.  I would like
to assign attributes from the two adjacent polygons to each line to
calculate the contrast between properties across the contact.
</pre>
    </blockquote>
    One way to go about this will involve using GRASS-GIS. In GRASS
    there's a module named 'v.to.db' which can attach to a line feature
    the "id" of each adjacent polygon. Note that this requires that the
    polygons and lines are strictly "topological", meaning that at every
    intersection between two lines there is a node.  This happens
    automatically when you import vector layers into GRASS.  In
    addition, you need to add to the line feature two integer columns in
    advance to hold the "id" of the right and left polygons.<br>
    Here's a section of the v.to.db manual page that describes the
    process of attaching :<br>
    (from <a class="moz-txt-link-freetext" href="http://grass.osgeo.org/grass65/manuals/v.to.db.html">http://grass.osgeo.org/grass65/manuals/v.to.db.html</a>)<br>
--------------------------------------------------------------------------------------------------------------------<br>
    Upload category numbers of left and right area, to an attribute
    table of boundaries common for the areas:<br>
    <br>
    # add categories for boundaries of the input vector map, in layer 2:<br>
    v.category soils out=mysoils layer=2 type=boundary option=add<br>
    # add a table with columns named "left" and "right" to layer 2 of
    the input<br>
    # vector map:<br>
    v.db.addtable mysoils layer=2 col="left integer,right integer"<br>
    # upload categories of left and right areas:<br>
    v.to.db mysoils option=sides col=left,right layer=2<br>
    # display the result:<br>
    v.db.select mysoils layer=2<br>
---------------------------------------------------------------------------------------------------<br>
    Now you will have in your lines vector two columns with the "id"s
    ("cat" in GRASS terminology) of the right and left polygon areas.
    You still need to get the attribute values you're interested in from
    the polys to the lines. THis will be done with a database join. 
    GRASS has the module 'v.db.join' for this. It will go something like<br>
    <br>
    v.db.join map=geolog_contacts column=right otable=geolog_polygons
    ocolumn=cat   <br>
    v.db.join map=geolog_contacts column=left otable=geolog_polygons
    ocolumn=cat <br>
    <br>
    Two comments:<br>
    The above modules are not in the  QGIS Processing menu. So you will
    need to start GRASS on its own, and perform these steps directly in
    GRASS.<br>
    The v.db.join module needs the GRASS vectors to be stored in a
    database such as sqlite. This is the default for GRASS 7., but not
    for GRASS 6.4,  If you're using 6.4, you'll need to first change the
    default database for sqlite before importing the vector layers. This
    is done with 'db.connect'. <br>
    <br>
    Cheers,<br>
    Micha<br>
     <br>
    <blockquote cite="mid:1403987947674-5148578.post@n6.nabble.com"
      type="cite">
      <pre wrap="">
I've been impressed (but a little overwhelmed) at the number of tools
available.  I have a feeling this might be covered in one of them, but I'm
not finding it so far.  It could be done with some PostGIS code, but if
there is a tools already available I would prefer to use that.

Thanks.
John





--
View this message in context: <a class="moz-txt-link-freetext" href="http://osgeo-org.1560.x6.nabble.com/Applying-adjacent-polygon-s-attributes-to-lines-tp5148578.html">http://osgeo-org.1560.x6.nabble.com/Applying-adjacent-polygon-s-attributes-to-lines-tp5148578.html</a>
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a>

This mail was received via Mail-SeCure System.


</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Moshav Idan
D.N. Arava, 86840
cell: 0523-665918
<a class="moz-txt-link-freetext" href="http://www.surfaces.co.il">http://www.surfaces.co.il</a></pre>
  </body>
</html>