Update:  So I thought that QgsPolyline-&gt;at(int).x() and QgsPolyline-&gt;at(int).y() methods were working but upon further investigation, they aren&#39;t working either.  It only returns the correct x value for x1.  All of the other values are very small i.e. 1e-308<br>
<br><div class="gmail_quote">On Tue, Sep 15, 2009 at 10:09 PM, Matthew Denno <span dir="ltr">&lt;<a href="mailto:mgdenno@gmail.com">mgdenno@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thank you everyone for your help.  I really apprecand iate it as I am trying to learn the QGIS API and C++.  I think that I have a solid plan to achieve my goal now.  However, I seem to be stuck on something that I think should be simple, looping through the points of a QgsPolyline.  If I iterate through the Polylines and print out the point coordinates using -&gt;at(int).x() I can print out x1, y1, x2, and y2 with out problems.  But, if I try to iterate through the points of the polyline and print out the coordinates, I get x1, y1 and then a bunch of junk values for the first 3 polylines and then eventually it ends unexpectedly.  Below is the code I am trying to use.<br>

<br>

<p style="margin: 0px; text-indent: 0px;">    //now iterate through each polyline feature</p>
<p style="margin: 0px; text-indent: 0px;">    while (mypPolylineLayer-&gt;nextFeature(currentPolylineFeat))</p>
<p style="margin: 0px; text-indent: 0px;">    {</p>
<p style="margin: 0px; text-indent: 0px;">        qDebug(&quot;feature = %i&quot;,f);</p>
<p style="margin: 0px; text-indent: 0px;">        ++f;</p><p style="margin: 0px; text-indent: 0px;"><br></p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">        //get point geometry for current feature</p>
<p style="margin: 0px; text-indent: 0px;">        QgsGeometry * currentPolylineGeom = currentPolylineFeat.geometry();</p>
<p style="margin: 0px; text-indent: 0px;">        QgsPolyline * currentPolyline;</p>
<p style="margin: 0px; text-indent: 0px;">        currentPolyline = &amp;currentPolylineGeom-&gt;asPolyline();</p>
<p style="margin: 0px; text-indent: 0px;">         </p>
<p style="margin: 0px; text-indent: 0px;">        //this part works</p>
<p style="margin: 0px; text-indent: 0px;">        qDebug() &lt;&lt; &quot;x1 = &quot; &lt;&lt; currentPolyline-&gt;at(0).x();</p>
<p style="margin: 0px; text-indent: 0px;">        qDebug() &lt;&lt; &quot;y1 = &quot; &lt;&lt; currentPolyline-&gt;at(0).y();</p>
<p style="margin: 0px; text-indent: 0px;">        qDebug() &lt;&lt; &quot;x2 = &quot; &lt;&lt; currentPolyline-&gt;at(1).x();</p>
<p style="margin: 0px; text-indent: 0px;">        qDebug() &lt;&lt; &quot;y2 = &quot; &lt;&lt; currentPolyline-&gt;at(1).y();</p><p style="margin: 0px; text-indent: 0px;"><br></p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">        QgsPolyline::const_iterator it = currentPolyline-&gt;constBegin();</p>
<p style="margin: 0px; text-indent: 0px;">        for(; it != currentPolyline-&gt;constEnd(); ++it)</p>
<p style="margin: 0px; text-indent: 0px;">        {</p>
<p style="margin: 0px; text-indent: 0px;">            //this part doesn&#39;t</p>
<p style="margin: 0px; text-indent: 0px;">            qDebug() &lt;&lt; &quot;x = &quot; &lt;&lt; (*it).x();</p>
<p style="margin: 0px; text-indent: 0px;">            qDebug() &lt;&lt; &quot;y = &quot; &lt;&lt; (*it).y();</p><div><div></div><div class="h5">
<p style="margin: 0px; text-indent: 0px;">        }</p>
<p style="margin: 0px; text-indent: 0px;">    }</p><br><br><div class="gmail_quote">On Tue, Sep 15, 2009 at 5:48 AM, Carson Farmer <span dir="ltr">&lt;<a href="mailto:carson.farmer@gmail.com" target="_blank">carson.farmer@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Basically the polylines need to be &quot;dissolved&quot; first.  Is there an existing function to acheive this? </blockquote>
</div><div><br>You will likely need to do this yourself by finding segments that share a node, and creating a single line from all the associated QgsPoints.<br> <br></div><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


Also, is there an enexisting function to union polygons programaticlly?<br></blockquote></div><div><br>Certainly, check out QgsGeometry.combine() in the docs.<br><font color="#888888"><br>Carson<br></font></div></div><div>

<div></div><div><br clear="all"><br>-- <br>Carson Farmer<br>
National Centre for Geocomputation<br>John Hume Building,<br>National University of Ireland, Maynooth,<br>Maynooth,<br>Co. Kildare,<br>Ireland.<br><a href="http://www.carsonfarmer.com" target="_blank">www.carsonfarmer.com</a><br>


</div></div></blockquote></div><br>
</div></div></blockquote></div><br>