Friday, 27 September 2019

qgis - How to write a expression in field calculator for finding $X and $Y?


I'm trying to calculate the lat/long of points using the Q GIS field calculator.Nathan W suggested to First, save the layer as WGS84 and import it again. Then in the field calculator you can use $x or $y as a variable to get the x and y. but the problem is this: i dont know how to write a expression in field calculator for finding $X and $Y?




Answer



You have your answer already. In field calculator expression, just type '$x' (without the quotes) to populate a Longitude field, and the '$y' for Latitude Field. You calculate them one at a time.


If you don't have a latitude and longitude fields yet, you can select the "Create a new field" box on the top of the dialog and create them.


If you have more doubts about how to use the calculator itself, then the QGIS user manual is very helpful, take a look into the field calculator chapter.


Hope it helps!


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...