<div dir="ltr">Hi Alexander,<div><br></div><div>Thanks for your reply. In my understanding, this only applies if I have point coordinates, right? If I have polygons I think I need another syntax?</div><div><br></div><div>I can create centroids in Vector > Geometry > Polygon Centroids tool then apply $x and $y to extract lat lon coordinates, but in some cases I want to skip this process if I am dealing with more than 300 thousand features in my polygon layer.</div>

<div><br></div><div>Thanks,</div><div>-Leo</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 28, 2014 at 3:01 PM, Alexandre Neto <span dir="ltr"><<a href="mailto:senhor.neto@gmail.com" target="_blank">senhor.neto@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><p dir="ltr">Hello Leo,</p>
<p dir="ltr">That's quite straightforward actually. In the field calculator (or in any other instance of expression builder) there are 2 geometry functions to achieve what you need,  $x and $y.</p>
<p dir="ltr">You can either put them in separate fields or create a string to populate a single one. Something like this,</p>
<p dir="ltr">$x || ' , ' || $y</p>
<p dir="ltr">Would produce something like this:</p>
<p dir="ltr">'1234.56 , 9876.43'</p>
<p dir="ltr">Notice that the double pipe character || works as a string concatenator. And that the result is a string therefore not useful for any arithmetic operations after. </p>
<p dir="ltr">Hope this helped.</p>
<p dir="ltr">Best regards, </p>
<p dir="ltr">Alexandre Neto</p>
</div><div class="gmail_quote"><div class="">Em 27/08/2014 22:37, "Leo Kris Palao" <<a href="mailto:lk.palao@gmail.com" target="_blank">lk.palao@gmail.com</a>> escreveu:<br type="attribution"></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<p>Hi QGIS users,</p><div><div class="h5">
<p>I don't know if this question has been asked before. </p>
<p>Can you help me create a syntax in field calculator to add in the attribute table the centroids coordinates for each or selected polygon features?</p>
<p>I am using Qgis 2.2 "Valmiera" version in Windows.</p>
<p>Thanks in advance for help,<br>
-Leo</p>
<br></div></div><div class="">_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br></div></blockquote></div>
</blockquote></div><br></div>