QGIS Cannot show Grid Layer Attribute Table variables as Degrees

attribute-tableqgis

I have for the first time opened QGIS 3 on my Mac. I am trying to create a rectangle grid of 50mx50m cells. I then want the centroid of each cell of the grid shown in the attribute table. I can get to this using a scratch layer but the format of the attribute table is shown in metres not decimal degrees. enter image description here

Best Answer

Firstly, it looks like you created your grid in EPSG:3857 Pseudo Mercator. Although it uses meters, it is not recommended for analysis or accurate distance measurements. I would suggest a local UTM coordinate reference system such as WGS84 / UTM zone 18N EPSG:32618. You can select this in the algorithm dialog when you create your grid. Click the CRS selector button (shown in the screenshot below) to open CRS selection Dialog.

enter image description here

You can filter the list by typing (e.g. 'utm zone 18') into the search bar at the top of the dialog (see below). Select the CRS and click OK.

enter image description here

After creating your grid you can easily add the centroid lat and long values in decimal degrees using the field calculator. Add two new fields e.g. centroid-lon and centroid_lat (making sure to use type Decimal number (real) and set an appropriate precision) and populate them with the following expressions:

x(transform(centroid($geometry), 'EPSG:32618', 'EPSG:4326'))

y(transform(centroid($geometry), 'EPSG:32618', 'EPSG:4326'))

enter image description here

enter image description here

You should see a result in the attribute table similar to below:

enter image description here

Related Question