Clustering points and summing up attributes per cluster in QGISHow 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?

A Journey Through Space and Time

Are there any consumables that function as addictive (psychedelic) drugs?

Why is the design of haulage companies so “special”?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

What do you call something that goes against the spirit of the law, but is legal when interpreting the law to the letter?

"which" command doesn't work / path of Safari?

How can I fix this gap between bookcases I made?

If Manufacturer spice model and Datasheet give different values which should I use?

How is this relation reflexive?

Patience, young "Padovan"

When blogging recipes, how can I support both readers who want the narrative/journey and ones who want the printer-friendly recipe?

Circuitry of TV splitters

I probably found a bug with the sudo apt install function

least quadratic residue under GRH: an EXPLICIT bound

Could a US political party gain complete control over the government by removing checks & balances?

Shell script can be run only with sh command

What are these boxed doors outside store fronts in New York?

XeLaTeX and pdfLaTeX ignore hyphenation

Draw simple lines in Inkscape

Why CLRS example on residual networks does not follows its formula?

LED on same Pin as Toggle Switch, not illuminating

How can the DM most effectively choose 1 out of an odd number of players to be targeted by an attack or effect?

TGV timetables / schedules?

Prevent a directory in /tmp from being deleted



Clustering points and summing up attributes per cluster in QGIS


How 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?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








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 Mar 30 at 0:39









      PolyGeo

      53.8k1781245




      53.8k1781245










      asked Mar 29 at 7:20









      cbrcbr

      454




      454




















          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
            Mar 29 at 14:16












          • 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
            Mar 29 at 14:23












          • @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
            Mar 29 at 21:47











          • @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
            Mar 29 at 22:03












          • 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
            Mar 30 at 7:33











          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
            Mar 29 at 14:16












          • 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
            Mar 29 at 14:23












          • @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
            Mar 29 at 21:47











          • @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
            Mar 29 at 22:03












          • 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
            Mar 30 at 7:33















          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
            Mar 29 at 14:16












          • 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
            Mar 29 at 14:23












          • @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
            Mar 29 at 21:47











          • @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
            Mar 29 at 22:03












          • 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
            Mar 30 at 7:33













          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 Mar 30 at 21:36

























          answered Mar 29 at 8:43









          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
            Mar 29 at 14:16












          • 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
            Mar 29 at 14:23












          • @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
            Mar 29 at 21:47











          • @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
            Mar 29 at 22:03












          • 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
            Mar 30 at 7:33

















          • 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
            Mar 29 at 14:16












          • 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
            Mar 29 at 14:23












          • @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
            Mar 29 at 21:47











          • @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
            Mar 29 at 22:03












          • 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
            Mar 30 at 7:33
















          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
          Mar 29 at 14:16






          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
          Mar 29 at 14:16














          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
          Mar 29 at 14:23






          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
          Mar 29 at 14:23














          @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
          Mar 29 at 21:47





          @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
          Mar 29 at 21:47













          @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
          Mar 29 at 22:03






          @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
          Mar 29 at 22:03














          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
          Mar 30 at 7:33





          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
          Mar 30 at 7:33

















          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

          Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

          Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

          Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?