I have a CSV file including some coordinates in degrees. I need to have these coordinates in the meter unit. I tried to add it as a shapefile in QGIS, then I saved the features and set a projected CRS. Afterward, I read this new shapefile into QGIS but still, the longitude and latitude values are in degrees. How can I convert the longitude and latitude values to meters?
-
3You mean values that you see in the attribute table? They are static attributes and do not update automatically. Once you have re-projected the data into desired projected CRS you must update the attributes with a field calculator docs.qgis.org/3.16/en/docs/user_manual/working_with_vector/….– user30184Commented Dec 22, 2020 at 10:05
-
1By right clicking on the layer and saving features as, in this step, I set the CRS to a projected CRS– ElhamCommented Dec 22, 2020 at 10:07
-
2A question that asks "How can I do this in X, Y, or Z?" should be broken into three questions, so that people looking for answers to "How do I do this in X" or "How do I do this in Y" can get directed to accepted solutions. Please edit this question to the one system (QGIS, Excel, or R) you'd prefer and if you are bothered much about the other two, ask as separate questions - although this is a common operation and the answer should already exist....– SpacedmanCommented Dec 22, 2020 at 11:13
2 Answers
Attributes are static. They do not update automatically (Except in virtual layers or fields). You can use fieldcalculator in QGIS on your shapefile with these expressions to update your fields:
For X: x(transform($geometry, layer_property(@layer_name, 'crs'),'EPSG:3006'))
For Y: y(transform($geometry, layer_property(@layer_name, 'crs'),'EPSG:3006'))
This expression does not require to reproject your layer first. It will detect your source CRS and transform the coordinates to EPSG:3006
. Note that you can not change values of a CSV.
I suggest you use a Add geometry attributes tool to calculate coordinates in meters (no reprojection required).