<html><head></head><body><div class="ydp7f821cacyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
<div dir="ltr" data-setdir="false">Hi Francesca,</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Assuming that your layer has a geographic coordinate system like 4326. And you have found your centroids already:<br></div><div dir="ltr" data-setdir="false">Use the field calculator to add a new or virtual field with a numeric data type, e.g. double, and name it something like "lat". Then in the expression area enter the expression: $y <br></div><div dir="ltr" data-setdir="false">and press OK. Do the same for "lon" and the expression will be: $x <br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">If you want to find the centroid of a polygon and its latitude in one step your expression would be: y<span>(centroid($geometry)) </span><br></div><div dir="ltr" data-setdir="false">For longitude it would be: <span>x(centroid($geometry)) <br></span></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Note that different methods will give you different coordinates for your centroid. So you may need to use a spatial join to do your match. <br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">-Thayer</div><div dir="ltr" data-setdir="false"><br></div><div><br></div>
</div><div id="ydpa16bbee7yahoo_quoted_3455132721" class="ydpa16bbee7yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Tuesday, May 24, 2022, 06:22:46 AM EDT, qgis-user-request@lists.osgeo.org <qgis-user-request@lists.osgeo.org> wrote:
</div><br><div><div dir="ltr">----------------------------------------------------------------------<br></div><div dir="ltr">Date: Tue, 24 May 2022 09:52:26 +0200<br></div><div dir="ltr">From: Francesca Parente <<a href="mailto:francescaparente.rse@gmail.com" rel="nofollow" target="_blank">francescaparente.rse@gmail.com</a>><br></div><div dir="ltr">To: QGIS User List <<a href="mailto:qgis-user@lists.osgeo.org" rel="nofollow" target="_blank">qgis-user@lists.osgeo.org</a>><br></div><div dir="ltr">Subject: [Qgis-user] visualize and export coordinates of centroids<br></div><div dir="ltr">Message-ID:<br></div><div dir="ltr"> <CAA8dZSc04zGiUy5JZhEARj0+<a href="mailto:ddP1L8z_abcSdXpRS5CYi6oieg@mail.gmail.com" rel="nofollow" target="_blank">ddP1L8z_abcSdXpRS5CYi6oieg@mail.gmail.com</a>><br></div><div dir="ltr">Content-Type: text/plain; charset="utf-8"<br></div><div dir="ltr"><br></div><div dir="ltr">Hello group,<br></div><div dir="ltr"><br></div><div dir="ltr">I would like to ask you what is in your opinion the best way to identify<br></div><div dir="ltr">the lat-lon attributes of derived centroids in order to export them to an<br></div><div dir="ltr">extra-QGis database where corresponding coordinates should match with<br></div><div dir="ltr">identified locations.<br></div><div dir="ltr"><br></div><div dir="ltr">So far I've tried with Geocoding and MMQGIS plugins, but the resulting<br></div><div dir="ltr">attributes table doesn't inlcude the coordinates of geocoded points.<br></div><div dir="ltr"><br></div><div dir="ltr">Thanks a lot for any advice!<br></div><div dir="ltr">Francesca<br></div><div dir="ltr"><br></div><div dir="ltr">-- <br></div><div dir="ltr">----------------------------<br></div><div dir="ltr">Francesca Parente<br></div><div dir="ltr"><br></div></div>
</div>
</div></body></html>