Selecting an amount of features that together sum up to a certain value?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
4
down vote
favorite
I am looking for a way in QGIS to randomly select features within my shapefile. The selected features together need to sum up to more or less 2000m2.
So, it is not selecting 10% of the features, but 10% of the sum of one attribute of the features (20 000 m2 in this case)
qgis area select
add a comment |Â
up vote
4
down vote
favorite
I am looking for a way in QGIS to randomly select features within my shapefile. The selected features together need to sum up to more or less 2000m2.
So, it is not selecting 10% of the features, but 10% of the sum of one attribute of the features (20 000 m2 in this case)
qgis area select
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I am looking for a way in QGIS to randomly select features within my shapefile. The selected features together need to sum up to more or less 2000m2.
So, it is not selecting 10% of the features, but 10% of the sum of one attribute of the features (20 000 m2 in this case)
qgis area select
I am looking for a way in QGIS to randomly select features within my shapefile. The selected features together need to sum up to more or less 2000m2.
So, it is not selecting 10% of the features, but 10% of the sum of one attribute of the features (20 000 m2 in this case)
qgis area select
qgis area select
edited Aug 13 at 10:56
Kadir
3,6771025
3,6771025
asked Aug 13 at 9:50
Jtv
232
232
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
accepted
I don't think ther's an out of the box solution for this. One option for you would be to use Python to create a script. If however, you aren't familiar with coding you can try the following...
Create your area field using field calculator and if you haven't got one already create an id field with sequential numbers from 1 to the total number of features in the layer. Then export the layer to csv and open in excel.
Order the table by the id column and create a new field calling 'running_total'. Assuming your area field is column c and row 1 are your headers, calculate the running total with the formula =SUM($C$2:$C2). If you're familiar with excel you'll notice that all the references are absolute except the last one, so Drag this formula to the bottom and you'll get the running total. This is better explained here. Note down the id where the running total is closest to 20000.
Back in QGIS select by attribute all features who's ids are less than or equal to the id you noted earlier.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
I don't think ther's an out of the box solution for this. One option for you would be to use Python to create a script. If however, you aren't familiar with coding you can try the following...
Create your area field using field calculator and if you haven't got one already create an id field with sequential numbers from 1 to the total number of features in the layer. Then export the layer to csv and open in excel.
Order the table by the id column and create a new field calling 'running_total'. Assuming your area field is column c and row 1 are your headers, calculate the running total with the formula =SUM($C$2:$C2). If you're familiar with excel you'll notice that all the references are absolute except the last one, so Drag this formula to the bottom and you'll get the running total. This is better explained here. Note down the id where the running total is closest to 20000.
Back in QGIS select by attribute all features who's ids are less than or equal to the id you noted earlier.
add a comment |Â
up vote
4
down vote
accepted
I don't think ther's an out of the box solution for this. One option for you would be to use Python to create a script. If however, you aren't familiar with coding you can try the following...
Create your area field using field calculator and if you haven't got one already create an id field with sequential numbers from 1 to the total number of features in the layer. Then export the layer to csv and open in excel.
Order the table by the id column and create a new field calling 'running_total'. Assuming your area field is column c and row 1 are your headers, calculate the running total with the formula =SUM($C$2:$C2). If you're familiar with excel you'll notice that all the references are absolute except the last one, so Drag this formula to the bottom and you'll get the running total. This is better explained here. Note down the id where the running total is closest to 20000.
Back in QGIS select by attribute all features who's ids are less than or equal to the id you noted earlier.
add a comment |Â
up vote
4
down vote
accepted
up vote
4
down vote
accepted
I don't think ther's an out of the box solution for this. One option for you would be to use Python to create a script. If however, you aren't familiar with coding you can try the following...
Create your area field using field calculator and if you haven't got one already create an id field with sequential numbers from 1 to the total number of features in the layer. Then export the layer to csv and open in excel.
Order the table by the id column and create a new field calling 'running_total'. Assuming your area field is column c and row 1 are your headers, calculate the running total with the formula =SUM($C$2:$C2). If you're familiar with excel you'll notice that all the references are absolute except the last one, so Drag this formula to the bottom and you'll get the running total. This is better explained here. Note down the id where the running total is closest to 20000.
Back in QGIS select by attribute all features who's ids are less than or equal to the id you noted earlier.
I don't think ther's an out of the box solution for this. One option for you would be to use Python to create a script. If however, you aren't familiar with coding you can try the following...
Create your area field using field calculator and if you haven't got one already create an id field with sequential numbers from 1 to the total number of features in the layer. Then export the layer to csv and open in excel.
Order the table by the id column and create a new field calling 'running_total'. Assuming your area field is column c and row 1 are your headers, calculate the running total with the formula =SUM($C$2:$C2). If you're familiar with excel you'll notice that all the references are absolute except the last one, so Drag this formula to the bottom and you'll get the running total. This is better explained here. Note down the id where the running total is closest to 20000.
Back in QGIS select by attribute all features who's ids are less than or equal to the id you noted earlier.
answered Aug 13 at 10:41
firefly-orange
1,616118
1,616118
add a comment |Â
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f292593%2fselecting-an-amount-of-features-that-together-sum-up-to-a-certain-value%23new-answer', 'question_page');
);
Post as a guest
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
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
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