I've uploaded shapefiles with professionally supplied survey data into QGIS and it all plots fine, then when I export the attributes table into Excel I see that the XYZ values are all zeros.

I know they can't be zero as all the data points are plotting on my map. then when I select each point and view attributes table, sure enough, the XYZ fields are zero, however I do see a tab labelled derived, which when selected does show all of the XYZ attributes that I require.

Does anyone know how to extract these derived data fields from shapefiles so I can merge the values with the previously exported attributes Excel file and have all the survey information I need within a single file.

Extra information added below on 13/03/19.

the data i have is shape files extracted from civil cad that contains survey information of drainage pipes and pits. it has x,y,z and other comments. everything appears in the attributes tables except the xyz information which can be viewed in the derived tab, but not the attribute table. i would be happy to show you screenshots if i could post them.

the attributes table is produced in excel by the following steps 1. right click on the shapefile in layers list 2. select export-save feature as 3. then select excel file from list and follow the prompts

the result is a file with copy of the attributes from the shapefile. but the upstream and downstream E and N coords are zero.

the x,y coords i found when i use identify and right click - then select a pipe or pit from the displayed map. the identify results show feature and value columns where the attributes are displayed and also a derived tab. under the derived tab when expanded, there is the x and y coords for pit or start and end of pipe for whichever feature is selected.

im trying to get the coords under the derived tab extracted and shown in the attributes table as upsteam or downstream E and N coords.

so far ive only been able to do this by hand one at a time, but there must be a better way.

  • 2
    The points are positioned by their geometry not by their fields, you can calculate the X, Y and Z values using the field calculator docs.qgis.org/2.8/en/docs/user_manual/working_with_vector/… (X = $X, Y = $Y and hopefully there's a Z to calculate to $Z but that's not guaranteed, your shapefile could be 2d and not 3d). Be very careful with Excel and DBF files, if you save them it will break the shapefile, best to copy the DBF somewhere else before opening in Excel then it doesn't matter if you accidentally save it. Commented Mar 12, 2019 at 6:42

1 Answer 1


It could be that the CRS of the layer is not the same as the projects' CRS. In the Attribute Table > Field Calculator field try updating your newly created attribute fields X and Y with the following codes respectively:

x(transform($geometry, 'EPSG:current', 'EPSG:target'))

y(transform($geometry, 'EPSG:current', 'EPSG:target'))

I found the code in this solution (although for another question) to do the trick for me.


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.