Bug report #11665

gdalogr:ogr2ogr doesn't consider -a_srs option converting to GeoJSON

Added by Luigi Pirelli over 9 years ago. Updated about 9 years ago.

Status:Closed
Priority:High
Assignee:Victor Olaya
Category:Processing/GDAL
Affected QGIS version:2.6.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:19916

Description

processing.runalg("gdalogr:ogr2ogr","F:/GIS/GISDATA/qgis_sample_data/shapefiles/alaska.shp",1,"-a_srs epsg:2964","F:/temp/pippo.geojs")

or generating a temporary file

processing.runalg("gdalogr:ogr2ogr","F:/GIS/GISDATA/qgis_sample_data/shapefiles/alaska.shp",1,"-a_srs epsg:2964",None)

generate a geoJSON with the default srs (WGS84)

but doing the direct command in the OSGeo4W shell

ogr2ogr -a_srs epsg:2964 -t "GeoJSON" F:/temp/pippo.geojs F:/GIS/GISDATA/qgis_sample_data/shapefiles/alaska.shp

generate a GeoJSON with the correct srs inside.

********
QGIS version 2.7.0-Master QGIS code revision 991f94d
Compiled against Qt 4.8.5 Running against Qt 4.8.5
Compiled against GDAL/OGR 1.11.0 Running against GDAL/OGR 1.11.1
Compiled against GEOS 3.4.2-CAPI-1.8.2 Running against GEOS 3.4.2-CAPI-1.8.2 r3921
PostgreSQL Client Version 9.2.4 SpatiaLite Version 4.1.1
QWT Version 5.2.3 PROJ.4 Version 480
QScintilla2 Version 2.7.2 This copy of QGIS writes debugging output.

pippo3.geojson (828 KB) Giovanni Manghi, 2014-11-18 12:11 PM

History

#1 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Open to Feedback

you should use t_srs.

#2 Updated by Luigi Pirelli over 9 years ago

Giovanni Manghi wrote:

you should use t_srs.

a_srs force srs instead of reproyecting as in t_srs... in my case I don't need reproyection because the converted layer has the same srs

#3 Updated by Luigi Pirelli over 9 years ago

Giovanni Manghi wrote:

you should use t_srs.

??? it doesn't work with -t_srs too... but it works using ogr2ogr command line (as also in a_srs)

#4 Updated by Giovanni Manghi over 9 years ago

Luigi Pirelli wrote:

Giovanni Manghi wrote:

you should use t_srs.

a_srs force srs instead of reproyecting as in t_srs... in my case I don't need reproyection because the converted layer has the same srs

just tested with the qgis sample dataset on Linux and it works as expected on both the CLI and from processing. Attached the output from processing.

#5 Updated by Luigi Pirelli over 9 years ago

  • Resolution set to invalid

so it's a local problem

#6 Updated by Giovanni Manghi about 9 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF