Skip to main content
edited tags
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
deleted 613 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

After a few comments and my own consideration I've completely Edited the content (and title) of this post.


QUESTION

What are valid "output_layer" parameter options when scripting with the "saveselectedfeatures" tool?


 

I'm writing a script that uses the tool as follows:

processing.runandload('qgis:saveselectedfeatures', Input, 'Output.shp')

I also tried removing the shapefile extension and just putting 'Output' as the final parameter. Still errors and no resulting output.

BTW don'tDon't worry about "Input", it's a perfectly valid layer with selected features.


 

PARTIAL SOLUTION

Thanks to @Joseph forprovided the partial solution of replacing " 'Output.shp' " with " None " (no quotations).

processing.runandload('qgis:saveselectedfeatures', Input, None)

This results in successful execution with a temporary output layer called "Solution" popping up in the Layers Window.


 

BUT...

I call this a partial solution because I find it hard to believe that the designer(s) of this tool didn't also intend to give users the option to choose the name of their output file (as I originally tried to do) via the final parameter ('output_layer'), as described in the tool's Help Tab.


 

FINAL THOUGHTS

The tool's Help tab offers the following instruction:

enter image description here

enter image description here

But it seems this is not quite as "helpful" as it could be. It seems like a few short and simple examples of acceptable values for the 2nd parameter would avoid any confusion.

Something like:

Output file options:  temporary layer, Shapefile, etc...

2nd Parameter ('output_layer') options:  
" 'User_chosen_name' " (or " 'User_chosen_name.shp' "), OR "None" (produces auto-named temporary layer). 

I say this only in the interest of being constructive. I'mI'm a relatively new user of Q, and I realize it's an open-source volunteer-driven project, and in that context it's a truly impressive piece of software, but it seems the Help tabs often fall just short of being truly informative, in the sense of empowering the average scripter to use them "out of the box", without having to research elsewhere (e.g. books, and online resources like GIS_SE).

I'm not averse to backing my words with action and contributing to the software in areas like this, but I haven't the first idea of how to do soQGIS.

After a few comments and my own consideration I've completely Edited the content (and title) of this post.


QUESTION

What are valid "output_layer" parameter options when scripting with the "saveselectedfeatures" tool?


 

I'm writing a script that uses the tool as follows:

processing.runandload('qgis:saveselectedfeatures', Input, 'Output.shp')

I also tried removing the shapefile extension and just putting 'Output' as the final parameter. Still errors and no resulting output.

BTW don't worry about "Input", it's a perfectly valid layer with selected features.


 

PARTIAL SOLUTION

Thanks to @Joseph for the partial solution of replacing " 'Output.shp' " with " None " (no quotations).

processing.runandload('qgis:saveselectedfeatures', Input, None)

This results in successful execution with a temporary output layer called "Solution" popping up in the Layers Window.


 

BUT...

I call this a partial solution because I find it hard to believe that the designer(s) of this tool didn't also intend to give users the option to choose the name of their output file (as I originally tried to do) via the final parameter ('output_layer'), as described in the tool's Help Tab.


 

FINAL THOUGHTS

The tool's Help tab offers the following instruction:

enter image description here

enter image description here

But it seems this is not quite as "helpful" as it could be. It seems like a few short and simple examples of acceptable values for the 2nd parameter would avoid any confusion.

Something like:

Output file options:  temporary layer, Shapefile, etc...

2nd Parameter ('output_layer') options:  
" 'User_chosen_name' " (or " 'User_chosen_name.shp' "), OR "None" (produces auto-named temporary layer). 

I say this only in the interest of being constructive. I'm a relatively new user of Q, and I realize it's an open-source volunteer-driven project, and in that context it's a truly impressive piece of software, but it seems the Help tabs often fall just short of being truly informative, in the sense of empowering the average scripter to use them "out of the box", without having to research elsewhere (e.g. books, and online resources like GIS_SE).

I'm not averse to backing my words with action and contributing to the software in areas like this, but I haven't the first idea of how to do so.

After a few comments and my own consideration I've completely Edited the content (and title) of this post.

What are valid "output_layer" parameter options when scripting with the "saveselectedfeatures" tool?

I'm writing a script that uses the tool as follows:

processing.runandload('qgis:saveselectedfeatures', Input, 'Output.shp')

I also tried removing the shapefile extension and just putting 'Output' as the final parameter. Still errors and no resulting output.

Don't worry about "Input", it's a perfectly valid layer with selected features.

PARTIAL SOLUTION

@Joseph provided the partial solution of replacing " 'Output.shp' " with " None " (no quotations).

processing.runandload('qgis:saveselectedfeatures', Input, None)

This results in successful execution with a temporary output layer called "Solution" popping up in the Layers Window.

BUT...

I call this a partial solution because I find it hard to believe that the designer(s) of this tool didn't also intend to give users the option to choose the name of their output file (as I originally tried to do) via the final parameter ('output_layer'), as described in the tool's Help Tab.

FINAL THOUGHTS

The tool's Help tab offers the following instruction:

enter image description here

enter image description here

But it seems this is not quite as "helpful" as it could be. It seems like a few short and simple examples of acceptable values for the 2nd parameter would avoid any confusion.

Something like:

Output file options:  temporary layer, Shapefile, etc...

2nd Parameter ('output_layer') options:  
" 'User_chosen_name' " (or " 'User_chosen_name.shp' "), OR "None" (produces auto-named temporary layer). 

I'm a relatively new user of QGIS.

deleted 44 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

After a few comments and my own consideration I've completely Edited the content (and title) of this post.


QUESTION

What are valid "output_layer" parameter options when scripting with the "saveselectedfeatures" tool?


I'm writing a script that uses the tool as follows:

processing.runandload('qgis:saveselectedfeatures', Input, 'Output.shp')

I also tried removing the shapefile extension and just putting 'Output' as the final parameter. Still errors and no resulting output.

BTW don't worry about "Input", it's a perfectly valid layer with selected features.


PARTIAL SOLUTION

Thanks to @Joseph for the partial solution of replacing " 'Output.shp' " with " None " (no quotations).

processing.runandload('qgis:saveselectedfeatures', Input, None)

This results in successful execution with a temporary output layer called "Solution" popping up in the Layers Window.


BUT...

I call this a partial solution because I find it hard to believe that the designer(s) of this tool didn't also intend to give users the option to choose the name of their output file (as I originally tried to do) via the final parameter ('output_layer'), as described in the tool's Help Tab.


FINAL THOUGHTS

The tool's Help tab offers the following instruction:

enter image description here

enter image description here

But it seems this is not quite as "helpful" as it could be. It seems like a few short and simple examples of acceptable values for the 2nd parameter would avoid any confusion.

Something like:

Output file options:  temporary layer, Shapefile, etc...

2nd Parameter ('output_layer') options:  
" 'User_chosen_name' " (or " 'User_chosen_name.shp' "), OR "None" (produces auto-named temporary layer). 

I say this only in the interest of being constructive. I'm a relatively new user of Q, and I realize it's an open-source volunteer-driven project, and in that context it's a truly impressive piece of software, but it seems the Help tabs often fall just short of being truly informative, in the sense of empowering the average scripter to use them "out of the box", without having to research elsewhere (e.g. books, and online resources like GIS_SE).

I'm not averse to backing my words with action and contributing to the software in areas like this, but I haven't the first idea of how to do so. Thank you, and thanks in general for QGIS!

After a few comments and my own consideration I've completely Edited the content (and title) of this post.


QUESTION

What are valid "output_layer" parameter options when scripting with the "saveselectedfeatures" tool?


I'm writing a script that uses the tool as follows:

processing.runandload('qgis:saveselectedfeatures', Input, 'Output.shp')

I also tried removing the shapefile extension and just putting 'Output' as the final parameter. Still errors and no resulting output.

BTW don't worry about "Input", it's a perfectly valid layer with selected features.


PARTIAL SOLUTION

Thanks to @Joseph for the partial solution of replacing " 'Output.shp' " with " None " (no quotations).

processing.runandload('qgis:saveselectedfeatures', Input, None)

This results in successful execution with a temporary output layer called "Solution" popping up in the Layers Window.


BUT...

I call this a partial solution because I find it hard to believe that the designer(s) of this tool didn't also intend to give users the option to choose the name of their output file (as I originally tried to do) via the final parameter ('output_layer'), as described in the tool's Help Tab.


FINAL THOUGHTS

The tool's Help tab offers the following instruction:

enter image description here

enter image description here

But it seems this is not quite as "helpful" as it could be. It seems like a few short and simple examples of acceptable values for the 2nd parameter would avoid any confusion.

Something like:

Output file options:  temporary layer, Shapefile, etc...

2nd Parameter ('output_layer') options:  
" 'User_chosen_name' " (or " 'User_chosen_name.shp' "), OR "None" (produces auto-named temporary layer). 

I say this only in the interest of being constructive. I'm a relatively new user of Q, and I realize it's an open-source volunteer-driven project, and in that context it's a truly impressive piece of software, but it seems the Help tabs often fall just short of being truly informative, in the sense of empowering the average scripter to use them "out of the box", without having to research elsewhere (e.g. books, and online resources like GIS_SE).

I'm not averse to backing my words with action and contributing to the software in areas like this, but I haven't the first idea of how to do so. Thank you, and thanks in general for QGIS!

After a few comments and my own consideration I've completely Edited the content (and title) of this post.


QUESTION

What are valid "output_layer" parameter options when scripting with the "saveselectedfeatures" tool?


I'm writing a script that uses the tool as follows:

processing.runandload('qgis:saveselectedfeatures', Input, 'Output.shp')

I also tried removing the shapefile extension and just putting 'Output' as the final parameter. Still errors and no resulting output.

BTW don't worry about "Input", it's a perfectly valid layer with selected features.


PARTIAL SOLUTION

Thanks to @Joseph for the partial solution of replacing " 'Output.shp' " with " None " (no quotations).

processing.runandload('qgis:saveselectedfeatures', Input, None)

This results in successful execution with a temporary output layer called "Solution" popping up in the Layers Window.


BUT...

I call this a partial solution because I find it hard to believe that the designer(s) of this tool didn't also intend to give users the option to choose the name of their output file (as I originally tried to do) via the final parameter ('output_layer'), as described in the tool's Help Tab.


FINAL THOUGHTS

The tool's Help tab offers the following instruction:

enter image description here

enter image description here

But it seems this is not quite as "helpful" as it could be. It seems like a few short and simple examples of acceptable values for the 2nd parameter would avoid any confusion.

Something like:

Output file options:  temporary layer, Shapefile, etc...

2nd Parameter ('output_layer') options:  
" 'User_chosen_name' " (or " 'User_chosen_name.shp' "), OR "None" (produces auto-named temporary layer). 

I say this only in the interest of being constructive. I'm a relatively new user of Q, and I realize it's an open-source volunteer-driven project, and in that context it's a truly impressive piece of software, but it seems the Help tabs often fall just short of being truly informative, in the sense of empowering the average scripter to use them "out of the box", without having to research elsewhere (e.g. books, and online resources like GIS_SE).

I'm not averse to backing my words with action and contributing to the software in areas like this, but I haven't the first idea of how to do so.

edited title
Link
Waterman
  • 1.2k
  • 12
  • 29
Loading
added 164 characters in body
Source Link
Waterman
  • 1.2k
  • 12
  • 29
Loading
added 54 characters in body
Source Link
Waterman
  • 1.2k
  • 12
  • 29
Loading
deleted 555 characters in body; edited title
Source Link
Waterman
  • 1.2k
  • 12
  • 29
Loading
added 42 characters in body; edited title
Source Link
Waterman
  • 1.2k
  • 12
  • 29
Loading
deleted 3 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Loading
added 1549 characters in body
Source Link
Waterman
  • 1.2k
  • 12
  • 29
Loading
added 1549 characters in body
Source Link
Waterman
  • 1.2k
  • 12
  • 29
Loading
deleted 476 characters in body
Source Link
Waterman
  • 1.2k
  • 12
  • 29
Loading
edited title
Link
Waterman
  • 1.2k
  • 12
  • 29
Loading
added 19 characters in body; edited title
Source Link
Waterman
  • 1.2k
  • 12
  • 29
Loading
Source Link
Waterman
  • 1.2k
  • 12
  • 29
Loading