Automatically populate r.reclass rules based on table values
In QGIS I have a raster map showing land, snow and cloud zones, having resp. pixel values 1, 2, and 3. I extracted the mean altitude values (in m) of each zone on the basis of an underlying DEM and Zonal Statistics of the LecoS (Landscape Ecology Statistics) plugin. The results show in a table like:
On the basis of the mean values of zone 1 and 2, using r.rclass from the Processing Toolbox, I reclassified my zones using this reclass rules text file:
2588 thru 4497 = 1
4498 thru 5122 = 12
5123 thru 7533 = 2
(2588 is the minimum altitude of the DEM, 7533 the maximum altitude).
The result is a new raster map with zones land (1), snow (2) and mixed land-snow pixels (12). This works fine in separate steps and manually preparing the reclass rules text file.
However I have thousands of files to process!
How would it be possible to use the output of the table mean values to automatically populate a reclass rules text file, that can then be directly used in r.reclass?
r.reclass doesn't have an option to import values from an outside table file. I guess I need to write a script for this. I have no experience with scripts so far.
pyqgis qgis-2 qgis-modeler
add a comment |
In QGIS I have a raster map showing land, snow and cloud zones, having resp. pixel values 1, 2, and 3. I extracted the mean altitude values (in m) of each zone on the basis of an underlying DEM and Zonal Statistics of the LecoS (Landscape Ecology Statistics) plugin. The results show in a table like:
On the basis of the mean values of zone 1 and 2, using r.rclass from the Processing Toolbox, I reclassified my zones using this reclass rules text file:
2588 thru 4497 = 1
4498 thru 5122 = 12
5123 thru 7533 = 2
(2588 is the minimum altitude of the DEM, 7533 the maximum altitude).
The result is a new raster map with zones land (1), snow (2) and mixed land-snow pixels (12). This works fine in separate steps and manually preparing the reclass rules text file.
However I have thousands of files to process!
How would it be possible to use the output of the table mean values to automatically populate a reclass rules text file, that can then be directly used in r.reclass?
r.reclass doesn't have an option to import values from an outside table file. I guess I need to write a script for this. I have no experience with scripts so far.
pyqgis qgis-2 qgis-modeler
1
In recent QGIS versions there's a "reclassify by layer" algorithm - does this assist?
– ndawson
Feb 13 at 7:17
Looks promising but then I first have to fill manually a table with min, max and value values. That is the same as manually making a reclass values text file.
– henkth
Feb 13 at 8:03
I think you're looking at the wrong algorithm - there 2, one which requires a manual table, the other which can take the class values from an existing layer (e.g. the layer generated by LecoS). Potentially you could make a simple graphical model which runs the Lecos tool and then does the reclassify using its output, and run that using batch processing over all your layers.
– ndawson
Feb 13 at 9:30
I looked at the correct algorithm, but it needs the input of the table of a vector layer with geometry information. LecoS just produces a delimited text table with no geometry. That's why it didn't work. Thanks for your help anyway!
– henkth
Feb 13 at 11:03
add a comment |
In QGIS I have a raster map showing land, snow and cloud zones, having resp. pixel values 1, 2, and 3. I extracted the mean altitude values (in m) of each zone on the basis of an underlying DEM and Zonal Statistics of the LecoS (Landscape Ecology Statistics) plugin. The results show in a table like:
On the basis of the mean values of zone 1 and 2, using r.rclass from the Processing Toolbox, I reclassified my zones using this reclass rules text file:
2588 thru 4497 = 1
4498 thru 5122 = 12
5123 thru 7533 = 2
(2588 is the minimum altitude of the DEM, 7533 the maximum altitude).
The result is a new raster map with zones land (1), snow (2) and mixed land-snow pixels (12). This works fine in separate steps and manually preparing the reclass rules text file.
However I have thousands of files to process!
How would it be possible to use the output of the table mean values to automatically populate a reclass rules text file, that can then be directly used in r.reclass?
r.reclass doesn't have an option to import values from an outside table file. I guess I need to write a script for this. I have no experience with scripts so far.
pyqgis qgis-2 qgis-modeler
In QGIS I have a raster map showing land, snow and cloud zones, having resp. pixel values 1, 2, and 3. I extracted the mean altitude values (in m) of each zone on the basis of an underlying DEM and Zonal Statistics of the LecoS (Landscape Ecology Statistics) plugin. The results show in a table like:
On the basis of the mean values of zone 1 and 2, using r.rclass from the Processing Toolbox, I reclassified my zones using this reclass rules text file:
2588 thru 4497 = 1
4498 thru 5122 = 12
5123 thru 7533 = 2
(2588 is the minimum altitude of the DEM, 7533 the maximum altitude).
The result is a new raster map with zones land (1), snow (2) and mixed land-snow pixels (12). This works fine in separate steps and manually preparing the reclass rules text file.
However I have thousands of files to process!
How would it be possible to use the output of the table mean values to automatically populate a reclass rules text file, that can then be directly used in r.reclass?
r.reclass doesn't have an option to import values from an outside table file. I guess I need to write a script for this. I have no experience with scripts so far.
pyqgis qgis-2 qgis-modeler
pyqgis qgis-2 qgis-modeler
edited Feb 17 at 19:21
underdark♦
68.8k13178344
68.8k13178344
asked Feb 13 at 7:10
henkthhenkth
517
517
1
In recent QGIS versions there's a "reclassify by layer" algorithm - does this assist?
– ndawson
Feb 13 at 7:17
Looks promising but then I first have to fill manually a table with min, max and value values. That is the same as manually making a reclass values text file.
– henkth
Feb 13 at 8:03
I think you're looking at the wrong algorithm - there 2, one which requires a manual table, the other which can take the class values from an existing layer (e.g. the layer generated by LecoS). Potentially you could make a simple graphical model which runs the Lecos tool and then does the reclassify using its output, and run that using batch processing over all your layers.
– ndawson
Feb 13 at 9:30
I looked at the correct algorithm, but it needs the input of the table of a vector layer with geometry information. LecoS just produces a delimited text table with no geometry. That's why it didn't work. Thanks for your help anyway!
– henkth
Feb 13 at 11:03
add a comment |
1
In recent QGIS versions there's a "reclassify by layer" algorithm - does this assist?
– ndawson
Feb 13 at 7:17
Looks promising but then I first have to fill manually a table with min, max and value values. That is the same as manually making a reclass values text file.
– henkth
Feb 13 at 8:03
I think you're looking at the wrong algorithm - there 2, one which requires a manual table, the other which can take the class values from an existing layer (e.g. the layer generated by LecoS). Potentially you could make a simple graphical model which runs the Lecos tool and then does the reclassify using its output, and run that using batch processing over all your layers.
– ndawson
Feb 13 at 9:30
I looked at the correct algorithm, but it needs the input of the table of a vector layer with geometry information. LecoS just produces a delimited text table with no geometry. That's why it didn't work. Thanks for your help anyway!
– henkth
Feb 13 at 11:03
1
1
In recent QGIS versions there's a "reclassify by layer" algorithm - does this assist?
– ndawson
Feb 13 at 7:17
In recent QGIS versions there's a "reclassify by layer" algorithm - does this assist?
– ndawson
Feb 13 at 7:17
Looks promising but then I first have to fill manually a table with min, max and value values. That is the same as manually making a reclass values text file.
– henkth
Feb 13 at 8:03
Looks promising but then I first have to fill manually a table with min, max and value values. That is the same as manually making a reclass values text file.
– henkth
Feb 13 at 8:03
I think you're looking at the wrong algorithm - there 2, one which requires a manual table, the other which can take the class values from an existing layer (e.g. the layer generated by LecoS). Potentially you could make a simple graphical model which runs the Lecos tool and then does the reclassify using its output, and run that using batch processing over all your layers.
– ndawson
Feb 13 at 9:30
I think you're looking at the wrong algorithm - there 2, one which requires a manual table, the other which can take the class values from an existing layer (e.g. the layer generated by LecoS). Potentially you could make a simple graphical model which runs the Lecos tool and then does the reclassify using its output, and run that using batch processing over all your layers.
– ndawson
Feb 13 at 9:30
I looked at the correct algorithm, but it needs the input of the table of a vector layer with geometry information. LecoS just produces a delimited text table with no geometry. That's why it didn't work. Thanks for your help anyway!
– henkth
Feb 13 at 11:03
I looked at the correct algorithm, but it needs the input of the table of a vector layer with geometry information. LecoS just produces a delimited text table with no geometry. That's why it didn't work. Thanks for your help anyway!
– henkth
Feb 13 at 11:03
add a comment |
3 Answers
3
active
oldest
votes
First solution is to use r.reclass
as a batch process by right-clicking on it in process list
It opens a new window where you can add every raster one by one but it's still a tedious task for thousands of rasters.
For a massive treatment, the best way is to use a python script with rasterio lib. Something like this:
import os, sys, rasterio, glob #import lib
import numpy as np #import lib
rasters_folder = sys.argv[1] #path of raster folder
rasters_list = glob.glob('{0}/*.tif'.format(rasters_folder)) #create a list of rasters
for raster_path in rasters_list: #for each raster in the list do...
with rasterio.Env(): #work with rasterio environment
src = rasterio.open(raster_path) #open the raster
profil = src.profile #raster profile like height and width
img = src.read(1) #first band of raster
#3 reclassment conditions
img[np.where((2588 < img) & (img <= 4497)) ] = 1
img[np.where((4497 < img) & (img <= 5122)) ] = 12
img[np.where((5122 < img) & (img <= 7533)) ] = 2
#save result in a new raster
with rasterio.open('{}_reclass.tif'.format(os.path.splitext(raster_path)[0]), 'w', **profil) as dst:
dst.write(img, 1)
Thanks for your answer! I am aware of the batch processing. The problem is that all my raster files are different and will produce different mean values, so my reclass rules values are different for each file. I don't want to prepare the reclass rule files one by one manually in this case.
– henkth
Feb 13 at 11:09
1
@HenkThoma So the best way is to use a python script. You can do everything you want, it's more flexible than any other solution. I know to learn python it's a big time investment, but I did 2 years ago and I don't regret it.
– Tim C.
Feb 13 at 13:17
Thank you for the kind suggestion!
– henkth
Feb 13 at 14:28
add a comment |
Just a follow-up on my above question. I have been able to find a solution by learning more about python scripting. I did the following and it worked (for 1 file):
Maybe not the best code but this is my humble beginner attempt with a (for me) serious script.
In the graphic modeler of QGIS I managed to implement this script and use it for multiple files in batch processing.
I would like to thank everyone that tried to help with this post!
add a comment |
I would do this by writing simple field formulae in Excel. You can then copy and paste for your new tables and do it in such a way that the table or a number of columns within it can be exported as text using space delimiters. Alternatively, wrap that into a Python function for greater automation.
Thanks for the suggestion! I am not sure how to proceed in Excel, worse even how to do this in Python. If you could be so kind, could you show me how you would do it in Excel using the above mentioned mean values to get as an output the mentioned reclass rules txt. Greatly appreciated!
– henkth
Feb 13 at 11:35
add a 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%2f312002%2fautomatically-populate-r-reclass-rules-based-on-table-values%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
First solution is to use r.reclass
as a batch process by right-clicking on it in process list
It opens a new window where you can add every raster one by one but it's still a tedious task for thousands of rasters.
For a massive treatment, the best way is to use a python script with rasterio lib. Something like this:
import os, sys, rasterio, glob #import lib
import numpy as np #import lib
rasters_folder = sys.argv[1] #path of raster folder
rasters_list = glob.glob('{0}/*.tif'.format(rasters_folder)) #create a list of rasters
for raster_path in rasters_list: #for each raster in the list do...
with rasterio.Env(): #work with rasterio environment
src = rasterio.open(raster_path) #open the raster
profil = src.profile #raster profile like height and width
img = src.read(1) #first band of raster
#3 reclassment conditions
img[np.where((2588 < img) & (img <= 4497)) ] = 1
img[np.where((4497 < img) & (img <= 5122)) ] = 12
img[np.where((5122 < img) & (img <= 7533)) ] = 2
#save result in a new raster
with rasterio.open('{}_reclass.tif'.format(os.path.splitext(raster_path)[0]), 'w', **profil) as dst:
dst.write(img, 1)
Thanks for your answer! I am aware of the batch processing. The problem is that all my raster files are different and will produce different mean values, so my reclass rules values are different for each file. I don't want to prepare the reclass rule files one by one manually in this case.
– henkth
Feb 13 at 11:09
1
@HenkThoma So the best way is to use a python script. You can do everything you want, it's more flexible than any other solution. I know to learn python it's a big time investment, but I did 2 years ago and I don't regret it.
– Tim C.
Feb 13 at 13:17
Thank you for the kind suggestion!
– henkth
Feb 13 at 14:28
add a comment |
First solution is to use r.reclass
as a batch process by right-clicking on it in process list
It opens a new window where you can add every raster one by one but it's still a tedious task for thousands of rasters.
For a massive treatment, the best way is to use a python script with rasterio lib. Something like this:
import os, sys, rasterio, glob #import lib
import numpy as np #import lib
rasters_folder = sys.argv[1] #path of raster folder
rasters_list = glob.glob('{0}/*.tif'.format(rasters_folder)) #create a list of rasters
for raster_path in rasters_list: #for each raster in the list do...
with rasterio.Env(): #work with rasterio environment
src = rasterio.open(raster_path) #open the raster
profil = src.profile #raster profile like height and width
img = src.read(1) #first band of raster
#3 reclassment conditions
img[np.where((2588 < img) & (img <= 4497)) ] = 1
img[np.where((4497 < img) & (img <= 5122)) ] = 12
img[np.where((5122 < img) & (img <= 7533)) ] = 2
#save result in a new raster
with rasterio.open('{}_reclass.tif'.format(os.path.splitext(raster_path)[0]), 'w', **profil) as dst:
dst.write(img, 1)
Thanks for your answer! I am aware of the batch processing. The problem is that all my raster files are different and will produce different mean values, so my reclass rules values are different for each file. I don't want to prepare the reclass rule files one by one manually in this case.
– henkth
Feb 13 at 11:09
1
@HenkThoma So the best way is to use a python script. You can do everything you want, it's more flexible than any other solution. I know to learn python it's a big time investment, but I did 2 years ago and I don't regret it.
– Tim C.
Feb 13 at 13:17
Thank you for the kind suggestion!
– henkth
Feb 13 at 14:28
add a comment |
First solution is to use r.reclass
as a batch process by right-clicking on it in process list
It opens a new window where you can add every raster one by one but it's still a tedious task for thousands of rasters.
For a massive treatment, the best way is to use a python script with rasterio lib. Something like this:
import os, sys, rasterio, glob #import lib
import numpy as np #import lib
rasters_folder = sys.argv[1] #path of raster folder
rasters_list = glob.glob('{0}/*.tif'.format(rasters_folder)) #create a list of rasters
for raster_path in rasters_list: #for each raster in the list do...
with rasterio.Env(): #work with rasterio environment
src = rasterio.open(raster_path) #open the raster
profil = src.profile #raster profile like height and width
img = src.read(1) #first band of raster
#3 reclassment conditions
img[np.where((2588 < img) & (img <= 4497)) ] = 1
img[np.where((4497 < img) & (img <= 5122)) ] = 12
img[np.where((5122 < img) & (img <= 7533)) ] = 2
#save result in a new raster
with rasterio.open('{}_reclass.tif'.format(os.path.splitext(raster_path)[0]), 'w', **profil) as dst:
dst.write(img, 1)
First solution is to use r.reclass
as a batch process by right-clicking on it in process list
It opens a new window where you can add every raster one by one but it's still a tedious task for thousands of rasters.
For a massive treatment, the best way is to use a python script with rasterio lib. Something like this:
import os, sys, rasterio, glob #import lib
import numpy as np #import lib
rasters_folder = sys.argv[1] #path of raster folder
rasters_list = glob.glob('{0}/*.tif'.format(rasters_folder)) #create a list of rasters
for raster_path in rasters_list: #for each raster in the list do...
with rasterio.Env(): #work with rasterio environment
src = rasterio.open(raster_path) #open the raster
profil = src.profile #raster profile like height and width
img = src.read(1) #first band of raster
#3 reclassment conditions
img[np.where((2588 < img) & (img <= 4497)) ] = 1
img[np.where((4497 < img) & (img <= 5122)) ] = 12
img[np.where((5122 < img) & (img <= 7533)) ] = 2
#save result in a new raster
with rasterio.open('{}_reclass.tif'.format(os.path.splitext(raster_path)[0]), 'w', **profil) as dst:
dst.write(img, 1)
edited Feb 13 at 9:45
answered Feb 13 at 9:35
Tim C.Tim C.
435518
435518
Thanks for your answer! I am aware of the batch processing. The problem is that all my raster files are different and will produce different mean values, so my reclass rules values are different for each file. I don't want to prepare the reclass rule files one by one manually in this case.
– henkth
Feb 13 at 11:09
1
@HenkThoma So the best way is to use a python script. You can do everything you want, it's more flexible than any other solution. I know to learn python it's a big time investment, but I did 2 years ago and I don't regret it.
– Tim C.
Feb 13 at 13:17
Thank you for the kind suggestion!
– henkth
Feb 13 at 14:28
add a comment |
Thanks for your answer! I am aware of the batch processing. The problem is that all my raster files are different and will produce different mean values, so my reclass rules values are different for each file. I don't want to prepare the reclass rule files one by one manually in this case.
– henkth
Feb 13 at 11:09
1
@HenkThoma So the best way is to use a python script. You can do everything you want, it's more flexible than any other solution. I know to learn python it's a big time investment, but I did 2 years ago and I don't regret it.
– Tim C.
Feb 13 at 13:17
Thank you for the kind suggestion!
– henkth
Feb 13 at 14:28
Thanks for your answer! I am aware of the batch processing. The problem is that all my raster files are different and will produce different mean values, so my reclass rules values are different for each file. I don't want to prepare the reclass rule files one by one manually in this case.
– henkth
Feb 13 at 11:09
Thanks for your answer! I am aware of the batch processing. The problem is that all my raster files are different and will produce different mean values, so my reclass rules values are different for each file. I don't want to prepare the reclass rule files one by one manually in this case.
– henkth
Feb 13 at 11:09
1
1
@HenkThoma So the best way is to use a python script. You can do everything you want, it's more flexible than any other solution. I know to learn python it's a big time investment, but I did 2 years ago and I don't regret it.
– Tim C.
Feb 13 at 13:17
@HenkThoma So the best way is to use a python script. You can do everything you want, it's more flexible than any other solution. I know to learn python it's a big time investment, but I did 2 years ago and I don't regret it.
– Tim C.
Feb 13 at 13:17
Thank you for the kind suggestion!
– henkth
Feb 13 at 14:28
Thank you for the kind suggestion!
– henkth
Feb 13 at 14:28
add a comment |
Just a follow-up on my above question. I have been able to find a solution by learning more about python scripting. I did the following and it worked (for 1 file):
Maybe not the best code but this is my humble beginner attempt with a (for me) serious script.
In the graphic modeler of QGIS I managed to implement this script and use it for multiple files in batch processing.
I would like to thank everyone that tried to help with this post!
add a comment |
Just a follow-up on my above question. I have been able to find a solution by learning more about python scripting. I did the following and it worked (for 1 file):
Maybe not the best code but this is my humble beginner attempt with a (for me) serious script.
In the graphic modeler of QGIS I managed to implement this script and use it for multiple files in batch processing.
I would like to thank everyone that tried to help with this post!
add a comment |
Just a follow-up on my above question. I have been able to find a solution by learning more about python scripting. I did the following and it worked (for 1 file):
Maybe not the best code but this is my humble beginner attempt with a (for me) serious script.
In the graphic modeler of QGIS I managed to implement this script and use it for multiple files in batch processing.
I would like to thank everyone that tried to help with this post!
Just a follow-up on my above question. I have been able to find a solution by learning more about python scripting. I did the following and it worked (for 1 file):
Maybe not the best code but this is my humble beginner attempt with a (for me) serious script.
In the graphic modeler of QGIS I managed to implement this script and use it for multiple files in batch processing.
I would like to thank everyone that tried to help with this post!
edited Feb 17 at 5:52
answered Feb 17 at 5:46
henkthhenkth
517
517
add a comment |
add a comment |
I would do this by writing simple field formulae in Excel. You can then copy and paste for your new tables and do it in such a way that the table or a number of columns within it can be exported as text using space delimiters. Alternatively, wrap that into a Python function for greater automation.
Thanks for the suggestion! I am not sure how to proceed in Excel, worse even how to do this in Python. If you could be so kind, could you show me how you would do it in Excel using the above mentioned mean values to get as an output the mentioned reclass rules txt. Greatly appreciated!
– henkth
Feb 13 at 11:35
add a comment |
I would do this by writing simple field formulae in Excel. You can then copy and paste for your new tables and do it in such a way that the table or a number of columns within it can be exported as text using space delimiters. Alternatively, wrap that into a Python function for greater automation.
Thanks for the suggestion! I am not sure how to proceed in Excel, worse even how to do this in Python. If you could be so kind, could you show me how you would do it in Excel using the above mentioned mean values to get as an output the mentioned reclass rules txt. Greatly appreciated!
– henkth
Feb 13 at 11:35
add a comment |
I would do this by writing simple field formulae in Excel. You can then copy and paste for your new tables and do it in such a way that the table or a number of columns within it can be exported as text using space delimiters. Alternatively, wrap that into a Python function for greater automation.
I would do this by writing simple field formulae in Excel. You can then copy and paste for your new tables and do it in such a way that the table or a number of columns within it can be exported as text using space delimiters. Alternatively, wrap that into a Python function for greater automation.
edited Feb 13 at 9:18
answered Feb 13 at 9:09
MappaGnosisMappaGnosis
29.1k148106
29.1k148106
Thanks for the suggestion! I am not sure how to proceed in Excel, worse even how to do this in Python. If you could be so kind, could you show me how you would do it in Excel using the above mentioned mean values to get as an output the mentioned reclass rules txt. Greatly appreciated!
– henkth
Feb 13 at 11:35
add a comment |
Thanks for the suggestion! I am not sure how to proceed in Excel, worse even how to do this in Python. If you could be so kind, could you show me how you would do it in Excel using the above mentioned mean values to get as an output the mentioned reclass rules txt. Greatly appreciated!
– henkth
Feb 13 at 11:35
Thanks for the suggestion! I am not sure how to proceed in Excel, worse even how to do this in Python. If you could be so kind, could you show me how you would do it in Excel using the above mentioned mean values to get as an output the mentioned reclass rules txt. Greatly appreciated!
– henkth
Feb 13 at 11:35
Thanks for the suggestion! I am not sure how to proceed in Excel, worse even how to do this in Python. If you could be so kind, could you show me how you would do it in Excel using the above mentioned mean values to get as an output the mentioned reclass rules txt. Greatly appreciated!
– henkth
Feb 13 at 11:35
add a 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%2f312002%2fautomatically-populate-r-reclass-rules-based-on-table-values%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
1
In recent QGIS versions there's a "reclassify by layer" algorithm - does this assist?
– ndawson
Feb 13 at 7:17
Looks promising but then I first have to fill manually a table with min, max and value values. That is the same as manually making a reclass values text file.
– henkth
Feb 13 at 8:03
I think you're looking at the wrong algorithm - there 2, one which requires a manual table, the other which can take the class values from an existing layer (e.g. the layer generated by LecoS). Potentially you could make a simple graphical model which runs the Lecos tool and then does the reclassify using its output, and run that using batch processing over all your layers.
– ndawson
Feb 13 at 9:30
I looked at the correct algorithm, but it needs the input of the table of a vector layer with geometry information. LecoS just produces a delimited text table with no geometry. That's why it didn't work. Thanks for your help anyway!
– henkth
Feb 13 at 11:03