Hi Alexander,

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?

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.

Thanks,
-Leo


On Thu, Aug 28, 2014 at 3:01 PM, Alexandre Neto <senhor.n...@gmail.com>
wrote:

> 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.pa...@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@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to