[Qgis-developer] [Qgis-user] Centroid of polygon

Andreas Neumann a.neumann at carto.net
Tue Aug 5 02:58:10 PDT 2014


Hi,

For me it is very strange that

x(centroid($geometry))
y(centroid($geometry))

does not work in the QGIS expressions.

There is a $x and $y - but this does only work directly on a current
feature if it is a point feature.

The workaround with xmin/ymin

xmin(centroid($geometry))
ymin(centroid($geometry))

works, but seems cumbersome.

Could you open a ticket please?

Andreas

Am 04.08.2014 17:22, schrieb Goyo:
> This works in master:
> 
> xmin(centroid($geometry))
> ymin(centroid($geometry))
> 
> Goyo
> 
> 2014-08-04 18:28 GMT+02:00 Jonathan Moules <jonathanmoules at warwickshire.gov.uk>:
>> Hi list,
>> Quick question, how do you use the Field Calculator to get the centroid as
>> an attribute? I'm aware of this question answer:
>> http://gis.stackexchange.com/questions/11705/using-field-calculator-in-qgis-to-update-columns-with-centroid-coordinates
>> - but want to do it using just the field calculator.
>>
>> I see under "Geometry" that there's a "centroid" function, but can't figure
>> out how to use it for this purpose.
>>
>> Suggestions welcome.
>> Thanks,
>> Jonathan
>>
>> This transmission is intended for the named addressee(s) only and may
>> contain confidential, sensitive or personal information and should be
>> handled accordingly. Unless you are the named addressee (or authorised to
>> receive it for the addressee) you may not copy or use it, or disclose it to
>> anyone else. If you have received this transmission in error please notify
>> the sender immediately. All email traffic sent to or from us, including
>> without limitation all GCSX traffic, may be subject to recording and/or
>> monitoring in accordance with relevant legislation.
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
> 



More information about the Qgis-developer mailing list