Appearance
Variables ​
There are some useful variables that can be used as default values.
Here you can find the lists of:
- project and user variables introduced by Mergin Maps QGIS plugin that can be used to record information related to Mergin Maps workspace, project or users
- position variables that can be used to record GPS information
Project and user variables ​
The Mergin Maps QGIS plugin adds several variables that can be used in QGIS expressions:
| Variable name | Type | Sample value | Description |
|---|---|---|---|
@mm_full_name | Text (string) | Joe Schmoe | Full name of the currently logged in user, blank if the full name is not set |
@mm_username | Text (string) | joe-schmoe | Username of the user currently logged in to Mergin Maps |
@mm_user_email | Text (string) | joe.schmoe@mail.com | Email of the user currently logged in to Mergin Maps |
@mm_url | Text (string) | https://app.merginmaps.com | URL of the Mergin Maps service |
@mm_project_name | Text (string) | My project | Name of the active Mergin Maps project |
@mm_project_full_name | Text (string) | my-team/My project | Workspace and project name joined with a forward slash |
@mm_project_version | Number (integer) | 9 | Current version of the active project |
A common use case is to use @mm_username or @mm_user_email as the default value for one of the fields in a survey layer to automatically track who has added (and/or modified) a particular record.
mergin_ variable names still work!
QGIS variables listed here previously used the prefix mergin_. Now we use the prefix mm_ standing for Mergin Maps.
Both naming options are functional and will continue to work in the future: @mergin_user_email and @mm_user_email provide the same value when used in QGIS expressions.
Position Variables ​
With Mergin Maps mobile app, it is possible to access GPS information using extra position variables. Note that location permission has to be allowed and location service enabled.
Extra position variables can be used as default values in feature forms.
Following variables are supported:
| Variable name | Type | Description |
|---|---|---|
@position_coordinate | Geometry | A point with the coordinates in WGS84 |
@position_latitude | Number (decimal) | Latitude |
@position_longitude | Number (decimal) | Longitude |
@position_elevation | Number (decimal) | Orthometric or normal height. May not be available for some providers |
@position_altitude | Number (decimal) | Has been replaced by @position_elevation. It is still supported and returns the same values as @position_elevation. |
@position_elevation_ellipsoid | Number (decimal) | Ellipsoidal height. May not be available for some providers |
@position_geoid_separation | Number (decimal) | Geoid or quasi-geoid height (undulation). May not be available for some providers |
@position_direction | Number (integer) | The bearing measured in degrees clockwise from true north to the direction of travel |
@position_ground_speed | Number (decimal) | The ground speed, in meters/sec |
@position_vertical_speed | Number (decimal) | The vertical speed, in meters/sec |
@position_magnetic_variation | Number (decimal) | The angle between the horizontal component of the magnetic field and true north, in degrees. Also known as magnetic declination. A positive value indicates a clockwise direction from true north and a negative value indicates a counter-clockwise direction. |
@position_horizontal_accuracy | Number (decimal) | The accuracy of the provided latitude-longitude value, in meters |
@position_vertical_accuracy | Number (decimal) | The accuracy of the provided altitude value, in meters |
@position_from_gps | Boolean | True if recorded/edited feature's geometry corresponds with current user's position (position marker has the same location as the crosshairs marker) |
@position_satellites_visible | Number (integer) | Number of visible satellites |
@position_satellites_used | Number (integer) | Number of satellites used to calculate the position |
@position_gps_fix | Text (string) | GPS fix, e.g. "RTK float" |
@position_gps_antenna_height | Number (decimal) | Antenna height as defined in GPS settings |
@position_provider_type | Text (string) | GPS device type. For internal GPS, returns internal, for external GPS, returns external_bt (Bluetooth devices) or external_ip (network devices). |
@position_provider_name | Text (string) | GPS device name. For internal GPS, returns Internal, Internal (fused) or Internal (gps). For external GPS, returns the name of the external device. If mock location is detected, returns External (Mock). |
@position_provider_address | Text (string) | GPS device address. For internal GPS, returns devicegps, android_fused or android_gps. For external GPS, returns the MAC address (Bluetooth devices) or IP address with port (network devices). |
@position_hdop | Number (decimal) | Horizontal dilution of precision (HDOP) |
@position_vdop | Number (decimal) | Vertical dilution of precision (VDOP) |
@position_pdop | Number (decimal) | Position (3D) dilution of precision (PDOP) |
TIP
Dilution of precision (DOP) is a useful value that reflects the confidence level of achieved position precision. In addition to the horizontal and vertical accuracy, the appropriate DOP value (horizontal, vertical, or 3D) can be used to assess the overall quality of your survey accuracy.
You can read more about this topic e.g. on Wikipedia.