C

geoCoordinate QML Value Type

The coordinate type represents and stores a geographic position. More...

Import Statement: import QtPositioning
Since: Qt Quick Ultralite 2.10

Detailed Description

This type represents a geographic position in the form of latitude and longitude attributes. The latitude attribute specifies the number of decimal degrees above and below the equator. A positive latitude indicates the Northern Hemisphere and a negative latitude indicates the Southern Hemisphere. The longitude attribute specifies the number of decimal degrees east and west. A positive longitude indicates the Eastern Hemisphere and a negative longitude indicates the Western Hemisphere. Together, these attributes specify a two-dimensional position anywhere on the Earth's surface.

The isValid attribute can be used to test if a coordinate is valid. A coordinate is considered valid if it has a valid latitude and longitude. The latitude must be between -90 and 90 inclusive and the longitude must be between -180 and 180 inclusive.

The geoCoordinate type is used by the Map item in the Qt Location module for specifying the center of a Map.

Accuracy

The latitude and longitude attributes stored in the coordinate type are represented as doubles, giving them approximately 16 decimal digits of precision – enough to specify micrometers.

Example Usage

To create a geoCoordinate value, use its latitude and longitude components:

Map {
    center {
        latitude: -27.5
        longitude: 153.1
    }
}

Properties

latitude

real latitude

This property holds the latitude value of the geographical position (decimal degrees). A positive latitude indicates the Northern Hemisphere, and a negative latitude indicates the Southern Hemisphere. If the property has not been set, its default value is NaN.

longitude

real longitude

This property holds the longitude value of the geographical position (decimal degrees). A positive longitude indicates the Eastern Hemisphere, and a negative longitude indicates the Western Hemisphere. If the property has not been set, its default value is NaN.

isValid

bool isValid

This property holds the current validity of the coordinate. Coordinates are considered valid if they have been set with a valid latitude and longitude.

The latitude must be between -90 to 90 inclusive to be considered valid, and the longitude must be between -180 to 180 inclusive to be considered valid.

This is a read-only property.

Available under certain Qt licenses.
Find out more.