0

I am creating a form for QField use. As part of the points layer I have created, I need the location coordinates to be in the attribute table. I have created the appropriate Lat and long fields, then configured the field setting using expression: $x & $y. coords are auto-populated perfectly when using WGS84 (default in QGIS). However, I am using GDA94 Z55, and when I use the same expression, the preview shows Null (instead of a preview of the coordinate). What is the appropriate expression or pathway to make this work?

2
  • 2
    Welcome to GIS.SE. When you say 'using WGS84' and 'using GDA94 Z55', could you specify in each case (a) what the layer CRS is, and (b) what the project CRS is. For example, are you keeping the project CRS WGS84 in both instances but a different layer CRS? etc. Also when you say 'configured the field setting' do you mean you set a default value? If you can share some screenshots that may also assist.
    – she_weeds
    Jan 10, 2023 at 4:43
  • Thanks you kindly for your reply. I will do my best to get the wording right, as I am not a GIS specialist. I aim to have the Layer and Project CRZ the same. QGIS is telling me the default CRS is ESPG: 4326 - WGS 84. However, I am used to using UTMs, so I changed it to ESPG28355 GDA94 / MGA zone 55. I can get the form to populate the Lat. and long. fields when using the WGS 84 CRS, but not when using the GDA94 CRS. Jan 12, 2023 at 1:44

1 Answer 1

1

I have just tested this by creating a project with CRS GDA94 (EPSG 4283). I then added a shape file (same CRS) with fields Xcoord and Ycoord (decimal fields).

enter image description here

In Layer properties_Attributes Form I set the default of Xcoord =$x and checked 'apply default value on update' - similarly for YCoord.

enter image description here

This successfully adds the longitude and latitude to Xcoord and Ycoord. For the avoidance of doubt, for longitude simply type "$x" into the default value for longitude enter image description here

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.