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?
Bartok - Syncopation (1): Meaning of notes in between Grand Staff
How to write a definition with variants?
How do I align (1) and (2)?
Math-accent symbol over parentheses enclosing accented symbol (amsmath)
WOW air has ceased operation, can I get my tickets refunded?
Why don't programming languages automatically manage the synchronous/asynchronous problem?
Why do airplanes bank sharply to the right after air-to-air refueling?
The exact meaning of 'Mom made me a sandwich'
Where do students learn to solve polynomial equations these days?
Is it convenient to ask the journal's editor for two additional days to complete a review?
Is the D&D universe the same as the Forgotten Realms universe?
When you upcast Blindness/Deafness, do all targets suffer the same effect?
Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?
Rotate a column
Why is information "lost" when it got into a black hole?
Is there a difference between "Fahrstuhl" and "Aufzug"
Axiom Schema vs Axiom
How to check if all elements of 1 list are in the *same quantity* and in any order, in the list2?
Why did CATV standarize in 75 ohms and everyone else in 50?
What flight has the highest ratio of timezone difference to flight time?
Is there always a complete, orthogonal set of unitary matrices?
How to count occurrences of text in a file?
Should I tutor a student who I know has cheated on their homework?
How to prove a simple equation?
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?
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
add a comment |
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
add a comment |
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
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
qgis clustering connectivity-analysis
edited yesterday
PolyGeo♦
53.8k1781245
53.8k1781245
asked yesterday
cbrcbr
434
434
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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
).
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).
[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.
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 useCentroids
geoalgorithm. I will update my post. As to the center points (red circles) in my example, they werePoint 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! Thecentroids
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
20 hours ago
|
show 1 more comment
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
).
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).
[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.
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 useCentroids
geoalgorithm. I will update my post. As to the center points (red circles) in my example, they werePoint 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! Thecentroids
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
20 hours ago
|
show 1 more comment
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
).
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).
[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.
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 useCentroids
geoalgorithm. I will update my post. As to the center points (red circles) in my example, they werePoint 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! Thecentroids
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
20 hours ago
|
show 1 more comment
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
).
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).
[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.
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
).
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).
[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.
edited 6 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 useCentroids
geoalgorithm. I will update my post. As to the center points (red circles) in my example, they werePoint 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! Thecentroids
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
20 hours ago
|
show 1 more comment
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 useCentroids
geoalgorithm. I will update my post. As to the center points (red circles) in my example, they werePoint 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! Thecentroids
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
20 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
20 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
20 hours ago
|
show 1 more comment
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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