Bug report #18923

GDAL/OGR Convert Format, persistent/unwanted default output format

Added by Lance Evans almost 6 years ago. Updated over 5 years ago.

Affected QGIS version:3.0.2 Regression?:No
Operating System:Windows 10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:26755


1) In modeler, trying to convert a line shapefile to GPX using GDAL Convert Format. The algorithm insists on leaving in the default output format [-f "ESRI Shapefile"] even though I've input [-f "GPX"] in the Additional Creation Options. This results in an empty shapefile with standard GPX attributes (ele, time, magvar, geoidheight, name, cmt, descr, etc.) The processing log illustrates how the GDAL command includes output formats for both shapefile and GPX

{ INPUT: 'output_7', OPTIONS: '-f "GPX"', OUTPUT: 'C:/somepath/gdal_convertformat_1_gpxout.shp' }
GDAL command:
ogr2ogr -f "ESRI Shapefile" -f "GPX" "C:/somepath/gdal_convertformat_1_gpxout.shp" C:/somepath/INPUT.shp INPUT

2) Similarly, using the Convert Format from the Processing Toolbox and only adding [-f "GPX"] to the additional creation options yields the following in the console call:
ogr2ogr -f "ESRI Shapefile" -f "GPX" "C:/somepath/OUTPUT.shp" path_to_data_file layer_name

3) Finally, for QGIS 3, there appears to be no means of modifying the GDAL command window. The Processing Toolbox Convert Format shows the resulting command window, but it is not editable.


#1 Updated by Nyall Dawson almost 6 years ago

The output format is automatically set based on the output file extension. It may be a silly question, but have you tried converting to a .gpx file destination?

#2 Updated by Nyall Dawson almost 6 years ago

  • Status changed from Open to Feedback

#3 Updated by Lance Evans almost 6 years ago

I had not as I'm trying to get temporary layer result. If I specify a GPX file for output, as opposed to leaving blank to create a temporary layer, it fails. Processing log gives: ERROR 4: Failed to create GPX file "somepath/outtest.gpx". ERROR 1: GPX driver failed to create "somepath/outtest.gpx"

The line layer being used as input can be saved as a GPX file with no issues, but I can't seem to complete conversion with GDAL Convert Format/ogr2ogr.

#4 Updated by Nyall Dawson almost 6 years ago

What's the gdal command when you try to export as gpx?

#5 Updated by Lance Evans almost 6 years ago

Using Convert Format from the Processing Toolbox, using no Additional Creation Options, and path/gpxtest.gpx as the converted file name, the console call shows:
ogr2ogr -f "ESRI Shapefile" "C:/Users/Lance/AppData/Local/Temp/processing_919f0c64ee7642c487acd74ea270cd12/12502b1eb597496ea7548d80c5b7b2b1/OUTPUT.shp" path_to_data_file layer_name

After running, the log shows the following was executed:
ogr2ogr -f "GPX" "\"P:/Lunate Google Drive/QGIS Data/GPS Testing/gpxtest.gpx\"" C:/Users/Lance/AppData/Local/Temp/processing_919f0c64ee7642c487acd74ea270cd12/663e287d5e484d0d90b5a896c900760f/INPUT.shp INPUT

#6 Updated by Nyall Dawson over 5 years ago

  • Resolution set to fixed/implemented
  • Status changed from Feedback to Closed

Fixed in master

Also available in: Atom PDF