<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Hi Herbert,</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">The attribute table of the Centroids
      file should have the cluster number as one of the attributes (let
      me know if it doesn't). You can then do the following:</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">1) Add the X/Y coordinates to the
      Centroids attribute table (from the menu bar select Vector >
      Geometry Tools > Add Geometry Attributes).</div>
    <div class="moz-cite-prefix">2) In the Layers panel, right-click on
      the name of the new layer produced in step 1 (it will be something
      like "Added geom info") and select "Export > Save features as".
      Set the format to "Comma separated value" and save the file.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">That should do it.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Regards, Frank<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">On 2021/03/04 08:54, Herbert Chitate
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CABsnB=B-py0DKQ5bMmfUm_UE+8LOUT55Wfoj-N2i2Fc6JuDs=g@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi Frank,
        <div><br>
        </div>
        <div>You are an absolute life saver. Almost there. So I managed
          to generate the centroids. Thoroughly impressed for a new
          user!!!</div>
        <div><br>
        </div>
        <div>I have attached a screen shot of the results. </div>
        <div><br>
        </div>
        <div>Final question though is how do I extract the lat and lon
          of the centroids, into say a csv file with also a column with
          the cluster number they belong to (cluster number is what i
          used to demacate the different polygons in step 2 of your
          instructions)</div>
        <div><br>
        </div>
        <div>Many many many thanks</div>
        <div><br>
        </div>
        <div>Much appreciated</div>
        <div><br>
        </div>
        <div>Regards</div>
        <div><br>
        </div>
        <div>Herbert</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Mon, Mar 1, 2021 at 2:25 PM
          Frank Sokolic via qgis-za-user <<a
            href="mailto:qgis-za-user@lists.osgeo.org"
            moz-do-not-send="true">qgis-za-user@lists.osgeo.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div>
            <div>Hi Herbert,</div>
            <div><br>
            </div>
            <div>I haven't tested it but you could try something like
              this:</div>
            <div><br>
            </div>
            <div>1) Load the csv file into QGIS using the "Add Delimited
              Text Layer" tool (Shift + Ctrl + T)</div>
            <div>2) Use the "Minimum bounding geometry" tool to create a
              polygon around each cluster (Processing Toolbox >
              Vector geometry > Minimum bounding geometry)</div>
            <div>3) Generate centroids for each polygon (Processing
              Toolbox > Vector geometry > Centroids)</div>
            <div><br>
            </div>
            <div>Hope this helps.</div>
            <div><br>
            </div>
            <div>Regards, Frank.<br>
            </div>
            <div><br>
            </div>
            <div>On 2021/03/01 13:04, Herbert Chitate via qgis-za-user
              wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">Good afternoon All,
                <div><br>
                </div>
                <div>I am new to QGIS and was wondering if someone might
                  be able to assist me on an extraction I am trying to
                  do.</div>
                <div><br>
                </div>
                <div>I have lat and lon details for about 1,500
                  locations, which using python (kmeans), I have
                  clustered the data into 20 clusters of which I have
                  the details of the constituent members (+ gps
                  locations) that make up the 20 clusters. Info now in a
                  CSV file.</div>
                <div><br>
                </div>
                <div>How can I use QGIS to establish the lat and lon of
                  the centroids for each of the clusters?</div>
                <div><br>
                </div>
                <div>Thank you for the assistance.</div>
                <div><br>
                </div>
                <div>Regards</div>
                <div><br>
                </div>
                <div>Herbert</div>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
qgis-za-user mailing list
<a href="mailto:qgis-za-user@lists.osgeo.org" target="_blank" moz-do-not-send="true">qgis-za-user@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/qgis-za-user" target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-za-user</a>
</pre>
            </blockquote>
            <p><br>
            </p>
          </div>
          _______________________________________________<br>
          qgis-za-user mailing list<br>
          <a href="mailto:qgis-za-user@lists.osgeo.org" target="_blank"
            moz-do-not-send="true">qgis-za-user@lists.osgeo.org</a><br>
          <a
            href="https://lists.osgeo.org/mailman/listinfo/qgis-za-user"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-za-user</a><br>
        </blockquote>
      </div>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>