-1

I would like to run ogr2ogr script from a UI feature form button in QGIS, that would start some SQL script linked to the opened feature table, store the output back to database and ideally reload the layer sources.

enter image description here

For example:

ogr2ogr -f sqlite -update -overwrite -geomfield geom -a_srs EPSG:5514 -sql "<my_SQL_query>" <my_database>.sqlite <my_database>.sqlite -nln <my_table> -nlt linestring

I have tried to search for some tutorials, but generally I have found some on creating plugins for QGIS.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Aug 8, 2022 at 13:00

1 Answer 1

2

This use case should be covered by the answers to Execute ogr2ogr from python.

If it doesn't, please provide some more details on how the situation differs.

Kadir Şahbaz
78.6k57 gold badges260 silver badges407 bronze badges
answered Aug 8, 2022 at 18:52
1
  • That could be it. How can I define this function to be run on click button action in the form? I suppose the script has to be loaded on form load (python init code) and also point to the button object name. Commented Aug 9, 2022 at 6:24

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.