DD to DMS Conversion | QGIS Field Calculator

preview_player
Показать описание
To use the "to_dms" function in QGIS Field Calculator, follow these steps:

1. Open the attribute table of the layer containing the decimal degree values you want to convert.

2. Start the Field Calculator by right-clicking on the field header where you want to store the DMS values and selecting "Open Field Calculator."

3. In the Field Calculator dialog box, make sure the field you want to update is selected in the "Update existing field" dropdown, or select "Create a new field" if you want to create a new field for the DMS values.

4. In the expression area, enter the following expression using the "to_dms" function:

to_dms("decimal_degrees", 'y', 0, 'suffix')

In this expression:

"decimal_degrees" is the name of the field containing the decimal degree values you want to convert.
'y' specifies the axis as the Y-axis or latitude. Use 'x' for the X-axis or longitude.
0 represents the precision, which determines the number of decimal places in the seconds component of the DMS format. You can adjust this value as per your requirements.
Suffix represents the axis either N, E.

Make sure to replace "decimal_degrees" with the actual field name in your attribute table. The to_dms function will convert the decimal degree values in the specified field to DMS format based on the chosen axis and precision.

5. Once you input the correct expression in the QGIS Field Calculator, click the "OK" button to execute the calculation and update the field with the converted DMS values.

The "to_dms" function takes the decimal degree value as input and returns the corresponding value in DMS format.

Using the "to_dms" function simplifies the conversion process and provides a more concise expression.
Рекомендации по теме