Bug report #18313

Issue saving vector layer reprojected to a different coordinate reference system

Added by Savitri Galiana over 6 years ago. Updated almost 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Vectors
Affected QGIS version:2.18.17 Regression?:Yes
Operating System:Windows 64 bit Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:26203

Description

Hello,

I am using QGIS 2.18.17 (I have just installed it this week). I am trying to save a vector layer (created from a csv file) in a csv file but reprojecting the coordinate reference system to a different one, let's say from UTM to WGS84. The result that I am obtaining is a csv file with the coordinates but in the same reference system as the original vector layer, that is: UTM (it happens the same when I try a projection to any reference system). I used to do this with QGIS Essen with the expected result.
It would be very nice if someone could help me to find out what's the problem.
Thank you,

Savitri

TestVectorLayer.csv Magnifier - Original data (219 Bytes) Savitri Galiana, 2018-03-02 01:36 PM

TestVectorLayer_ResultUTM30.csv Magnifier - Resulting data (236 Bytes) Savitri Galiana, 2018-03-02 01:36 PM

TestVectorLayer_ResultWGS84.csv Magnifier - Resulting data (236 Bytes) Savitri Galiana, 2018-03-02 01:36 PM

QGIS_Issue.pdf - Screenshoots (569 KB) Savitri Galiana, 2018-03-02 01:37 PM

QGIS_solution.pdf (344 KB) Savitri Galiana, 2018-03-05 10:19 AM

TestVectorLayer_NewResultWGS84.csv Magnifier (578 Bytes) Savitri Galiana, 2018-03-05 10:19 AM

History

#1 Updated by Giovanni Manghi over 6 years ago

  • Category changed from Unknown to Vectors
  • Status changed from Open to Feedback

Please add more details, like the exact CRS involved, sample data and expected vs wrong results. Thanks.

#2 Updated by Savitri Galiana over 6 years ago

Giovanni Manghi wrote:

Please add more details, like the exact CRS involved, sample data and expected vs wrong results. Thanks.

Hello,

Thank you for your answer.
I'll try to be more specific and provide sample data.
The vector layer is in EPSG:25831, ETRS89/UTM Zone 31 (TestVectorLayer.csv) and I want to save it in EPSG:25830-ETRS89/UTM Zone 30, but I have the same problem if I try to save it in another coordinate reference system, for example, EPSG:4326-WGS84. The results I have obtained are: TestVectorLayer_ResultUTM30.csv and TestVectorLayer_ResultWGS84.csv, respectively. As you'll see it did not change the coordinate reference system and these files are the same as the original: TestVectorLayer.csv. I attach these three files and also screenshoots on how I am doing this.

Thank you again,

Savitri

#3 Updated by Giovanni Manghi over 6 years ago

  • Regression? changed from No to Yes
  • Priority changed from Normal to High
  • Status changed from Feedback to Open

#4 Updated by Harrissou Santanna over 6 years ago

  • Status changed from Open to Feedback

I think the issue is to have CRS widget available for non spatial format.

When you export a (point) layer to csv, as far as i know, you get the attributes shown in the layer; the geometry is not returned anywhere. While you know that the two fields are coordinate ones, for QGIS, they are attributes of the input layer. And no more!
If you want reprojected coordinates in the csv, you'd need to calculate them in a spatial layer and then export that one to csv.

my 2cts

#5 Updated by Savitri Galiana over 6 years ago

Thank you for your answer Harrissou.
I don't know if I understand much what you are telling me since I do not have a deep knowledge of the program yet.
However, my point is that I was doing exactly what I described with QGIS Essen and I was able to extract a csv file with the points in another coordinate system. Do you mean that maybe I had a "CRS widget" available for non spatial format? Do you know how could I do this with QGIS 2.18.17?
Thank you

Harrissou Santanna wrote:

I think the issue is to have CRS widget available for non spatial format.

When you export a (point) layer to csv, as far as i know, you get the attributes shown in the layer; the geometry is not returned anywhere. While you know that the two fields are coordinate ones, for QGIS, they are attributes of the input layer. And no more!
If you want reprojected coordinates in the csv, you'd need to calculate them in a spatial layer and then export that one to csv.

my 2cts

#6 Updated by Savitri Galiana over 6 years ago

Hello again,
It seems even if I did not understand completely your answer it guided me to find the solution :)
So, the thing is when you save the layer to set the GEOMETRY feature to: "AS_XY" (as I'm showing in the attached screenshot file); I imagine with this you are giving an spatial attribute to the data, and then the reprojection works. I also attached the resulting correct file that I am obtaining now.
Thank's a lot.

Savitri Galiana wrote:

Thank you for your answer Harrissou.
I don't know if I understand much what you are telling me since I do not have a deep knowledge of the program yet.
However, my point is that I was doing exactly what I described with QGIS Essen and I was able to extract a csv file with the points in another coordinate system. Do you mean that maybe I had a "CRS widget" available for non spatial format? Do you know how could I do this with QGIS 2.18.17?
Thank you

Harrissou Santanna wrote:

I think the issue is to have CRS widget available for non spatial format.

When you export a (point) layer to csv, as far as i know, you get the attributes shown in the layer; the geometry is not returned anywhere. While you know that the two fields are coordinate ones, for QGIS, they are attributes of the input layer. And no more!
If you want reprojected coordinates in the csv, you'd need to calculate them in a spatial layer and then export that one to csv.

my 2cts

#7 Updated by Jürgen Fischer almost 6 years ago

Please test with QGIS 3.4 - QGIS 2.18 reached it's end of life.

#8 Updated by salvatore fiandaca almost 6 years ago

  • Priority changed from High to Normal
  • Resolution set to invalid

I close issues because I found the solution.

#9 Updated by salvatore fiandaca almost 6 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF