Bug report #7382

Converting Coordinates on CSV Export

Added by Jules-Ange Infante about 11 years ago. Updated almost 10 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Projection Support
Affected QGIS version:master Regression?:No
Operating System:Linux Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:16354

Description

I have a Vector Layer (imported successfully from CSV) that I wish to export to CSV, but converting the X-Y coordinates from lat long to a projected transverse mercator. However, using Save As (on the layer) and using Selected CRS (or even Project CRS), does not produce any change in the output file, where the original coordinates are still used. Manipulating CSV files directly is potentially one of the most effective roles of qGIS, and doing this coordinate conversion successfully should be a priority.

Note that I have no problems converting coordinates on the fly when saving to other file formats, only to CSV.

History

#1 Updated by Giovanni Manghi about 11 years ago

  • Status changed from Open to Feedback

Is your vector layer a shapefile (for example)?

If you have the coordinates in columns of the table of attributes, those are just attributes, not the coordinates that define the geometries. When you export a vector with "save as..." and change the CRS along the way, you change the coordinates of the geometries, the table of attributes is unchanged. After the export you may want to recompute the coordinate in the table of attributes with the field calculator and the $x and $y tools.

#2 Updated by Giovanni Manghi almost 10 years ago

  • Resolution set to invalid
  • Status changed from Feedback to Closed

closing for lack of feedback.

#3 Updated by Jules-Ange Infante almost 10 years ago

The vector layer can be in any format, the problem persists. This DOES NOT happen if I try to export the same layer in another format, say DXF. In that case (the DXF export), if I specify an output CRS the exported file will be in the specified CRS independently of the CRS of the layer, and whether it was originally a shapefile, CSV file, or DXF. This is just not happening with CSV. QGIS would be very useful if it allowed on-the fly conversion of CRS to CSV (without requiring esoteric knowledge of the package). If ind this is a major deficiency in the software. This issue needs to be addressed at the export filter level, not by making it someone else's problem.

Giovanni Manghi wrote:

Is your vector layer a shapefile (for example)?

If you have the coordinates in columns of the table of attributes, those are just attributes, not the coordinates that define the geometries. When you export a vector with "save as..." and change the CRS along the way, you change the coordinates of the geometries, the table of attributes is unchanged. After the export you may want to recompute the coordinate in the table of attributes with the field calculator and the $x and $y tools.

#4 Updated by Giovanni Manghi almost 10 years ago

Jules-Ange Infante wrote:

The vector layer can be in any format, the problem persists. This DOES NOT happen if I try to export the same layer in another format, say DXF. In that case (the DXF export), if I specify an output CRS the exported file will be in the specified CRS independently of the CRS of the layer, and whether it was originally a shapefile, CSV file, or DXF. This is just not happening with CSV. QGIS would be very useful if it allowed on-the fly conversion of CRS to CSV (without requiring esoteric knowledge of the package). If ind this is a major deficiency in the software. This issue needs to be addressed at the export filter level, not by making it someone else's problem.

The latest versions of QGIS works as you expect.

PS
you don't need to be rude here, we are just trying to understand issues, help, fix and keep this tracker clean.

Also available in: Atom PDF