Clustering points and summing up attributes per cluster in QGIS The Next CEO of Stack OverflowHow to divide my area into adjacent polygons containing 80 points each?MYSQL 5.6 Cluster / chain points by distance to any other point without millions of calculations?Get a single cluster from cloud of points with specified maximum diameter in postgisIdentify points in a shapefile that have no other point within x km with QGISAlgorithm for clustering points into pairs (exactly two) by proximity without re-useHow can I cluster all points in a postgis table together based on their distance from each other?Clustering point data to obtain maximum count groups using QGIS?Reading attribute popup information from cluster presented points in the map generated via qgis2web?Cluster Points on spatial network in R/QGISGrouped “labels” for QGIS 3.0 Point Cluster styling?

What happened in Rome, when the western empire "fell"?

How do I align (1) and (2)?

Reference request: Grassmannian and Plucker coordinates in type B, C, D

Is wanting to ask what to write an indication that you need to change your story?

The exact meaning of 'Mom made me a sandwich'

Won the lottery - how do I keep the money?

Why didn't Khan get resurrected in the Genesis Explosion?

Prepend last line of stdin to entire stdin

Yu-Gi-Oh cards in Python 3

Is it ever safe to open a suspicious HTML file (e.g. email attachment)?

Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

Is French Guiana a (hard) EU border?

Can MTA send mail via a relay without being told so?

Does Germany produce more waste than the US?

How is this set of matrices closed under multiplication?

Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?

What steps are necessary to read a Modern SSD in Medieval Europe?

Why isn't acceleration always zero whenever velocity is zero, such as the moment a ball bounces off a wall?

Flying from Cape Town to England and return to another province

How to delete every two lines after 3rd lines in a file contains very large number of lines?

How to count occurrences of text in a file?

Unclear about dynamic binding

Why do remote US companies require working in the US?



Clustering points and summing up attributes per cluster in QGIS



The Next CEO of Stack OverflowHow to divide my area into adjacent polygons containing 80 points each?MYSQL 5.6 Cluster / chain points by distance to any other point without millions of calculations?Get a single cluster from cloud of points with specified maximum diameter in postgisIdentify points in a shapefile that have no other point within x km with QGISAlgorithm for clustering points into pairs (exactly two) by proximity without re-useHow can I cluster all points in a postgis table together based on their distance from each other?Clustering point data to obtain maximum count groups using QGIS?Reading attribute popup information from cluster presented points in the map generated via qgis2web?Cluster Points on spatial network in R/QGISGrouped “labels” for QGIS 3.0 Point Cluster styling?










7















We want to find out the ideal location for sheds and the required dimensions of each shed. As input, we have a point layer with locations (each representing one arable field) and the estimated yield per point (per arable field).



What we now try to do is first to create four clusters for these fields. This should serve as an approximation of the ideal location for a new shed. We've done this by simply using the "point cluster" option in the "symbology" section and adjusting the distance until only four cluster points remained. These cluster points were then saved as new point shapefile.



How do we determine what points are actually clustered in each of the cluster points?



With this information, we can then sum up the estimated yields for all the single points per cluster. This would allow us to calculate whether the shed has to be designed for 10 tons or 100 tons of grain.










share|improve this question




























    7















    We want to find out the ideal location for sheds and the required dimensions of each shed. As input, we have a point layer with locations (each representing one arable field) and the estimated yield per point (per arable field).



    What we now try to do is first to create four clusters for these fields. This should serve as an approximation of the ideal location for a new shed. We've done this by simply using the "point cluster" option in the "symbology" section and adjusting the distance until only four cluster points remained. These cluster points were then saved as new point shapefile.



    How do we determine what points are actually clustered in each of the cluster points?



    With this information, we can then sum up the estimated yields for all the single points per cluster. This would allow us to calculate whether the shed has to be designed for 10 tons or 100 tons of grain.










    share|improve this question


























      7












      7








      7


      1






      We want to find out the ideal location for sheds and the required dimensions of each shed. As input, we have a point layer with locations (each representing one arable field) and the estimated yield per point (per arable field).



      What we now try to do is first to create four clusters for these fields. This should serve as an approximation of the ideal location for a new shed. We've done this by simply using the "point cluster" option in the "symbology" section and adjusting the distance until only four cluster points remained. These cluster points were then saved as new point shapefile.



      How do we determine what points are actually clustered in each of the cluster points?



      With this information, we can then sum up the estimated yields for all the single points per cluster. This would allow us to calculate whether the shed has to be designed for 10 tons or 100 tons of grain.










      share|improve this question
















      We want to find out the ideal location for sheds and the required dimensions of each shed. As input, we have a point layer with locations (each representing one arable field) and the estimated yield per point (per arable field).



      What we now try to do is first to create four clusters for these fields. This should serve as an approximation of the ideal location for a new shed. We've done this by simply using the "point cluster" option in the "symbology" section and adjusting the distance until only four cluster points remained. These cluster points were then saved as new point shapefile.



      How do we determine what points are actually clustered in each of the cluster points?



      With this information, we can then sum up the estimated yields for all the single points per cluster. This would allow us to calculate whether the shed has to be designed for 10 tons or 100 tons of grain.







      qgis clustering connectivity-analysis






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday









      PolyGeo

      53.8k1781245




      53.8k1781245










      asked yesterday









      cbrcbr

      434




      434




















          1 Answer
          1






          active

          oldest

          votes


















          5














          I would try K-means clustering algorithm in the QGIS Processing Toolbox (under Vector analysis group).



          Just by setting the Number of clusters as 4, it will produce a new Clusters layer with an attribute field CLUSTER_ID (values= 0, 1, 2, 3).



          enter image description here



          Then an expression like SUM("yield", "CLUSTER_ID") in the Field Calculator will return the total yield for each cluster. (E.G. the Sum_per_Cluster in the below example).



          enter image description here




          [Update]



          To obtain center point per the group (cluster), please try Mean coordinate(s) geoalgorithm in Processing Toolbox > Vector analysis.



          Mean coordinates dialog window will show an option Unique ID field. Select CLUSTER_ID field.






          share|improve this answer

























          • Thank you very much for the quick and helpful reply! How did you create the center points of the clusters? When I use the method I described in my initial post (using "Symbology" and "Cluster"), I get center points completely off the actual cluster center (see [ibb.co/VmkhS0x]). This may stem from the different calculation methods. What approach did you use in your example? Furthermore, I get a lot of "NULL" results when I do the K-means clustering (see [ibb.co/VNdQ7bS]). Do you have a solution for this issue? Thank you very much!

            – cbr
            yesterday












          • Since I only get error pages when trying to access the uploaded images but cannot edit the comment anymore (>5 min), here other links: Cluster center -> imgur.com/a/fs3R1K1 ; NULL -> imgur.com/a/Cv7IuCr

            – cbr
            yesterday












          • @cbr To create center point for each cluster, please use Centroids geoalgorithm. I will update my post. As to the center points (red circles) in my example, they were Point cluster symbology just for comparison.

            – Kazuhito
            yesterday











          • @cbr Your upperleft (north western) cluster in the provided image has only two locations in that cluster, which does not seem right. (You would not build shed just for those two). I am not sure what happened with locations with NULL outputs; they may be outliers. Perhaps I would check their locations visually, and manually assign most appropriate cluster id.

            – Kazuhito
            yesterday












          • Thanks very much for your reply! The centroids algorithm only returns the same location for each of the selected points (so the output is a layer with the same amount of points as the input layer). I assume that the center point for each point was calculated but not one single point for the whole cluster... Is there another intermediate step necessary I made have missed?

            – cbr
            21 hours ago











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "79"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317107%2fclustering-points-and-summing-up-attributes-per-cluster-in-qgis%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5














          I would try K-means clustering algorithm in the QGIS Processing Toolbox (under Vector analysis group).



          Just by setting the Number of clusters as 4, it will produce a new Clusters layer with an attribute field CLUSTER_ID (values= 0, 1, 2, 3).



          enter image description here



          Then an expression like SUM("yield", "CLUSTER_ID") in the Field Calculator will return the total yield for each cluster. (E.G. the Sum_per_Cluster in the below example).



          enter image description here




          [Update]



          To obtain center point per the group (cluster), please try Mean coordinate(s) geoalgorithm in Processing Toolbox > Vector analysis.



          Mean coordinates dialog window will show an option Unique ID field. Select CLUSTER_ID field.






          share|improve this answer

























          • Thank you very much for the quick and helpful reply! How did you create the center points of the clusters? When I use the method I described in my initial post (using "Symbology" and "Cluster"), I get center points completely off the actual cluster center (see [ibb.co/VmkhS0x]). This may stem from the different calculation methods. What approach did you use in your example? Furthermore, I get a lot of "NULL" results when I do the K-means clustering (see [ibb.co/VNdQ7bS]). Do you have a solution for this issue? Thank you very much!

            – cbr
            yesterday












          • Since I only get error pages when trying to access the uploaded images but cannot edit the comment anymore (>5 min), here other links: Cluster center -> imgur.com/a/fs3R1K1 ; NULL -> imgur.com/a/Cv7IuCr

            – cbr
            yesterday












          • @cbr To create center point for each cluster, please use Centroids geoalgorithm. I will update my post. As to the center points (red circles) in my example, they were Point cluster symbology just for comparison.

            – Kazuhito
            yesterday











          • @cbr Your upperleft (north western) cluster in the provided image has only two locations in that cluster, which does not seem right. (You would not build shed just for those two). I am not sure what happened with locations with NULL outputs; they may be outliers. Perhaps I would check their locations visually, and manually assign most appropriate cluster id.

            – Kazuhito
            yesterday












          • Thanks very much for your reply! The centroids algorithm only returns the same location for each of the selected points (so the output is a layer with the same amount of points as the input layer). I assume that the center point for each point was calculated but not one single point for the whole cluster... Is there another intermediate step necessary I made have missed?

            – cbr
            21 hours ago















          5














          I would try K-means clustering algorithm in the QGIS Processing Toolbox (under Vector analysis group).



          Just by setting the Number of clusters as 4, it will produce a new Clusters layer with an attribute field CLUSTER_ID (values= 0, 1, 2, 3).



          enter image description here



          Then an expression like SUM("yield", "CLUSTER_ID") in the Field Calculator will return the total yield for each cluster. (E.G. the Sum_per_Cluster in the below example).



          enter image description here




          [Update]



          To obtain center point per the group (cluster), please try Mean coordinate(s) geoalgorithm in Processing Toolbox > Vector analysis.



          Mean coordinates dialog window will show an option Unique ID field. Select CLUSTER_ID field.






          share|improve this answer

























          • Thank you very much for the quick and helpful reply! How did you create the center points of the clusters? When I use the method I described in my initial post (using "Symbology" and "Cluster"), I get center points completely off the actual cluster center (see [ibb.co/VmkhS0x]). This may stem from the different calculation methods. What approach did you use in your example? Furthermore, I get a lot of "NULL" results when I do the K-means clustering (see [ibb.co/VNdQ7bS]). Do you have a solution for this issue? Thank you very much!

            – cbr
            yesterday












          • Since I only get error pages when trying to access the uploaded images but cannot edit the comment anymore (>5 min), here other links: Cluster center -> imgur.com/a/fs3R1K1 ; NULL -> imgur.com/a/Cv7IuCr

            – cbr
            yesterday












          • @cbr To create center point for each cluster, please use Centroids geoalgorithm. I will update my post. As to the center points (red circles) in my example, they were Point cluster symbology just for comparison.

            – Kazuhito
            yesterday











          • @cbr Your upperleft (north western) cluster in the provided image has only two locations in that cluster, which does not seem right. (You would not build shed just for those two). I am not sure what happened with locations with NULL outputs; they may be outliers. Perhaps I would check their locations visually, and manually assign most appropriate cluster id.

            – Kazuhito
            yesterday












          • Thanks very much for your reply! The centroids algorithm only returns the same location for each of the selected points (so the output is a layer with the same amount of points as the input layer). I assume that the center point for each point was calculated but not one single point for the whole cluster... Is there another intermediate step necessary I made have missed?

            – cbr
            21 hours ago













          5












          5








          5







          I would try K-means clustering algorithm in the QGIS Processing Toolbox (under Vector analysis group).



          Just by setting the Number of clusters as 4, it will produce a new Clusters layer with an attribute field CLUSTER_ID (values= 0, 1, 2, 3).



          enter image description here



          Then an expression like SUM("yield", "CLUSTER_ID") in the Field Calculator will return the total yield for each cluster. (E.G. the Sum_per_Cluster in the below example).



          enter image description here




          [Update]



          To obtain center point per the group (cluster), please try Mean coordinate(s) geoalgorithm in Processing Toolbox > Vector analysis.



          Mean coordinates dialog window will show an option Unique ID field. Select CLUSTER_ID field.






          share|improve this answer















          I would try K-means clustering algorithm in the QGIS Processing Toolbox (under Vector analysis group).



          Just by setting the Number of clusters as 4, it will produce a new Clusters layer with an attribute field CLUSTER_ID (values= 0, 1, 2, 3).



          enter image description here



          Then an expression like SUM("yield", "CLUSTER_ID") in the Field Calculator will return the total yield for each cluster. (E.G. the Sum_per_Cluster in the below example).



          enter image description here




          [Update]



          To obtain center point per the group (cluster), please try Mean coordinate(s) geoalgorithm in Processing Toolbox > Vector analysis.



          Mean coordinates dialog window will show an option Unique ID field. Select CLUSTER_ID field.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 7 hours ago

























          answered yesterday









          KazuhitoKazuhito

          16.3k41884




          16.3k41884












          • Thank you very much for the quick and helpful reply! How did you create the center points of the clusters? When I use the method I described in my initial post (using "Symbology" and "Cluster"), I get center points completely off the actual cluster center (see [ibb.co/VmkhS0x]). This may stem from the different calculation methods. What approach did you use in your example? Furthermore, I get a lot of "NULL" results when I do the K-means clustering (see [ibb.co/VNdQ7bS]). Do you have a solution for this issue? Thank you very much!

            – cbr
            yesterday












          • Since I only get error pages when trying to access the uploaded images but cannot edit the comment anymore (>5 min), here other links: Cluster center -> imgur.com/a/fs3R1K1 ; NULL -> imgur.com/a/Cv7IuCr

            – cbr
            yesterday












          • @cbr To create center point for each cluster, please use Centroids geoalgorithm. I will update my post. As to the center points (red circles) in my example, they were Point cluster symbology just for comparison.

            – Kazuhito
            yesterday











          • @cbr Your upperleft (north western) cluster in the provided image has only two locations in that cluster, which does not seem right. (You would not build shed just for those two). I am not sure what happened with locations with NULL outputs; they may be outliers. Perhaps I would check their locations visually, and manually assign most appropriate cluster id.

            – Kazuhito
            yesterday












          • Thanks very much for your reply! The centroids algorithm only returns the same location for each of the selected points (so the output is a layer with the same amount of points as the input layer). I assume that the center point for each point was calculated but not one single point for the whole cluster... Is there another intermediate step necessary I made have missed?

            – cbr
            21 hours ago

















          • Thank you very much for the quick and helpful reply! How did you create the center points of the clusters? When I use the method I described in my initial post (using "Symbology" and "Cluster"), I get center points completely off the actual cluster center (see [ibb.co/VmkhS0x]). This may stem from the different calculation methods. What approach did you use in your example? Furthermore, I get a lot of "NULL" results when I do the K-means clustering (see [ibb.co/VNdQ7bS]). Do you have a solution for this issue? Thank you very much!

            – cbr
            yesterday












          • Since I only get error pages when trying to access the uploaded images but cannot edit the comment anymore (>5 min), here other links: Cluster center -> imgur.com/a/fs3R1K1 ; NULL -> imgur.com/a/Cv7IuCr

            – cbr
            yesterday












          • @cbr To create center point for each cluster, please use Centroids geoalgorithm. I will update my post. As to the center points (red circles) in my example, they were Point cluster symbology just for comparison.

            – Kazuhito
            yesterday











          • @cbr Your upperleft (north western) cluster in the provided image has only two locations in that cluster, which does not seem right. (You would not build shed just for those two). I am not sure what happened with locations with NULL outputs; they may be outliers. Perhaps I would check their locations visually, and manually assign most appropriate cluster id.

            – Kazuhito
            yesterday












          • Thanks very much for your reply! The centroids algorithm only returns the same location for each of the selected points (so the output is a layer with the same amount of points as the input layer). I assume that the center point for each point was calculated but not one single point for the whole cluster... Is there another intermediate step necessary I made have missed?

            – cbr
            21 hours ago
















          Thank you very much for the quick and helpful reply! How did you create the center points of the clusters? When I use the method I described in my initial post (using "Symbology" and "Cluster"), I get center points completely off the actual cluster center (see [ibb.co/VmkhS0x]). This may stem from the different calculation methods. What approach did you use in your example? Furthermore, I get a lot of "NULL" results when I do the K-means clustering (see [ibb.co/VNdQ7bS]). Do you have a solution for this issue? Thank you very much!

          – cbr
          yesterday






          Thank you very much for the quick and helpful reply! How did you create the center points of the clusters? When I use the method I described in my initial post (using "Symbology" and "Cluster"), I get center points completely off the actual cluster center (see [ibb.co/VmkhS0x]). This may stem from the different calculation methods. What approach did you use in your example? Furthermore, I get a lot of "NULL" results when I do the K-means clustering (see [ibb.co/VNdQ7bS]). Do you have a solution for this issue? Thank you very much!

          – cbr
          yesterday














          Since I only get error pages when trying to access the uploaded images but cannot edit the comment anymore (>5 min), here other links: Cluster center -> imgur.com/a/fs3R1K1 ; NULL -> imgur.com/a/Cv7IuCr

          – cbr
          yesterday






          Since I only get error pages when trying to access the uploaded images but cannot edit the comment anymore (>5 min), here other links: Cluster center -> imgur.com/a/fs3R1K1 ; NULL -> imgur.com/a/Cv7IuCr

          – cbr
          yesterday














          @cbr To create center point for each cluster, please use Centroids geoalgorithm. I will update my post. As to the center points (red circles) in my example, they were Point cluster symbology just for comparison.

          – Kazuhito
          yesterday





          @cbr To create center point for each cluster, please use Centroids geoalgorithm. I will update my post. As to the center points (red circles) in my example, they were Point cluster symbology just for comparison.

          – Kazuhito
          yesterday













          @cbr Your upperleft (north western) cluster in the provided image has only two locations in that cluster, which does not seem right. (You would not build shed just for those two). I am not sure what happened with locations with NULL outputs; they may be outliers. Perhaps I would check their locations visually, and manually assign most appropriate cluster id.

          – Kazuhito
          yesterday






          @cbr Your upperleft (north western) cluster in the provided image has only two locations in that cluster, which does not seem right. (You would not build shed just for those two). I am not sure what happened with locations with NULL outputs; they may be outliers. Perhaps I would check their locations visually, and manually assign most appropriate cluster id.

          – Kazuhito
          yesterday














          Thanks very much for your reply! The centroids algorithm only returns the same location for each of the selected points (so the output is a layer with the same amount of points as the input layer). I assume that the center point for each point was calculated but not one single point for the whole cluster... Is there another intermediate step necessary I made have missed?

          – cbr
          21 hours ago





          Thanks very much for your reply! The centroids algorithm only returns the same location for each of the selected points (so the output is a layer with the same amount of points as the input layer). I assume that the center point for each point was calculated but not one single point for the whole cluster... Is there another intermediate step necessary I made have missed?

          – cbr
          21 hours ago

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317107%2fclustering-points-and-summing-up-attributes-per-cluster-in-qgis%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

          QGIS export composer to PDF scale the map [closed] Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Print Composer QGIS 2.6, how to export image?QGIS 2.8.1 print composer won't export all OpenCycleMap base layer tilesSave Print/Map QGIS composer view as PNG/PDF using Python (without changing anything in visible layout)?Export QGIS Print Composer PDF with searchable text labelsQGIS Print Composer does not change from landscape to portrait orientation?How can I avoid map size and scale changes in print composer?Fuzzy PDF export in QGIS running on macSierra OSExport the legend into its 100% size using Print ComposerScale-dependent rendering in QGIS PDF output

          PDF-ში გადმოწერა სანავიგაციო მენიუproject page