[Qgis-user] polygon centroids

Alexandre Neto senhor.neto at gmail.com
Thu Aug 28 00:01:13 PDT 2014


Hello Leo,

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.

You can either put them in separate fields or create a string to populate a
single one. Something like this,

$x || ' , ' || $y

Would produce something like this:

'1234.56 , 9876.43'

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.

Hope this helped.

Best regards,

Alexandre Neto
Em 27/08/2014 22:37, "Leo Kris Palao" <lk.palao at gmail.com> escreveu:

> Hi QGIS users,
>
> I don't know if this question has been asked before.
>
> 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?
>
> I am using Qgis 2.2 "Valmiera" version in Windows.
>
> Thanks in advance for help,
> -Leo
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20140828/88a3e10f/attachment.html>


More information about the Qgis-user mailing list