Quick summary
In QGIS, you can add coordinates to a point layer's attribute table by using the Field Calculator with $x and $y expressions, or by running the Add X/Y Fields to Layer tool from the Processing Toolbar. Both methods populate Longitude and Latitude fields directly in your layer's attribute data without requiring external plugins.
Steps
- Right-click your point layer in the Layers Panel and select Open Attribute Table.
- Click Toggle Editing (pencil icon) at the top-left corner of the dialog box.
- Select Field Calculator from the toolbar.
- Check Create a new field in the Field Calculator dialog.
- Set the Output field name to Longitude and the output field type to Decimal (real).
- Enter $x in the Expression box.
- Click OK to save the Longitude field.
- Repeat the process, setting the Output field name to Latitude and the field type to Decimal (real).
- Enter $y in the Expression box.
- Click OK to save the Latitude field.
- Open the Attribute Table again to verify that Longitude and Latitude coordinates were successfully added.
- Alternatively, click a point shapefile layer in the Layers Panel to use the Processing Toolbar method.
- Select the Toggle Editing button in the top menu.
- Click the Add Point tool to begin placing points on the map.
- Hover your cursor over the map and click to place a point.
- Enter an ID number for identification, then click OK. Repeat to add more points.
- Go to the Processing Toolbar and search for Add X/Y Fields to Layer, then select it.
- Choose the input layer in the tool dialog.
- Select your coordinate system.
- Click Run to execute the tool.
- Go to the added layer in your Layers panel.
- Right-click it and select Open Attribute Table to confirm the results.
- Verify that points with coordinates have been successfully added to your layer.
