1

I have overlaid a 10m x 10m grid onto a UK Ordnance Survey raster map. I have set both raster and vector maps to the same CRS, (OSGB 1936 British National Grid; ESPG:27700). I have a csv file containing biological survey information gathered at differing 10m quadrats. I want to join the survey data to my 10m x 10m grid as a new layer. However, when I open the attribute table, only Y co-ordinate data is shown. How do I make QGIS show both x and y co-ord attributes for a grid so that I can import my tabular information?

1
  • Sorry, I should specify when I open the attribute table of the 10m x 10m grid shapefile, only the Y coordinate info is shown.
    – Ben Wells
    Commented Jul 4, 2013 at 14:24

2 Answers 2

0

After activating edit mode with the pencil icon, you can add a new field with the field calculator (the symbol bottom right).

Enter a new field name, data type real, and select $x from the Geometry node.

5
  • Thanks Andre. This does produce an X co-ord field in the attribute table, but all the fields have NULL value? Is there another step required?
    – Ben Wells
    Commented Jul 4, 2013 at 15:45
  • You are right, $x and $y are for point geometries. Depending on what you want, you can create centroids from your grid (see gis.stackexchange.com/questions/45243/…) and use $x and $y, or convert your polygons to lines, and use xat(0) and yat(0) for the coordinates of the first point. By the way, QGIS vector grid tool creates polygon shapefiles with min and max coordinates in the attribute table.
    – AndreJ
    Commented Jul 4, 2013 at 17:00
  • Hmmm, the 10 x 10m grid was built using the vector grid tool which makes me wonder why both x and y co-ords are not displayed as a default setting?
    – Ben Wells
    Commented Jul 4, 2013 at 18:47
  • Did you create lines or polygons? Only with polygons you get xmin/max and ymin/max. If you have lines, you can use xat(0). The COORD field of the lines grid is only good for labelling.
    – AndreJ
    Commented Jul 4, 2013 at 19:17
  • I went back and drew the grid as a polygon which gave the co-ords that I was after. Thanks
    – Ben Wells
    Commented Jul 12, 2013 at 9:17
0

I went back and drew the grid as a polygon which gave the co-ords that I was after.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.