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 |
Properties
Methods
- real distanceTo(geoCoordinate other)
Detailed Description
This type represents a geographic position in the form of its latitude and longitude properties. The latitude property 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 property 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 property returns a boolean value indicating whether a coordinate is valid or not. A coordinate is considered valid depending on its latitude and longitude values. 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 properties:
Map { center { latitude: -27.5 longitude: 153.1 } }
Property Documentation
isValid : bool |
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.
latitude : real |
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 |
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.
Method Documentation
real distanceTo(geoCoordinate other) |
Returns the distance (in meters) from this coordinate to the coordinate specified by other.
This calculation returns the great-circle distance between the two coordinates, with an assumption that the Earth is spherical for the purpose of this calculation.
Returns 0 if this coordinate or other is invalid coordinate.
Available under certain Qt licenses.
Find out more.