内容表

上一话题

QGeoCircle

下一话题

QGeoLocation

QGeoCoordinate

QGeoCoordinate class defines a geographical position on the surface of the Earth. 更多

Inheritance diagram of PySide2.QtPositioning.QGeoCoordinate

概要

函数

详细描述

A QGeoCoordinate is defined by latitude, longitude, and optionally, altitude.

使用 type() to determine whether a coordinate is a 2D coordinate (has latitude and longitude only) or 3D coordinate (has latitude, longitude and altitude). Use distanceTo() and azimuthTo() to calculate the distance and bearing between coordinates.

The coordinate values should be specified using the WGS84 datum. For more information on geographical terms see this article on coordinates and another on geodetic systems including WGS84.

Azimuth in this context is equivalent to a compass bearing based on true north.

This class is a Q_GADGET since Qt 5.5. It can be directly used from C++ and QML .

class QGeoCoordinate

QGeoCoordinate(other)

QGeoCoordinate(latitude, longitude)

QGeoCoordinate(latitude, longitude, altitude)

param latitude

double

param longitude

double

param other

QGeoCoordinate

param altitude

double

Constructs a coordinate. The coordinate will be invalid until setLatitude() and setLongitude() 有被调用。

Constructs a coordinate with the given latitude and longitude .

If the latitude is not between -90 to 90 inclusive, or the longitude is not between -180 to 180 inclusive, none of the values are set and the type() 将是 InvalidCoordinate .

另请参阅

isValid()

Constructs a coordinate with the given latitude , longitude and altitude .

If the latitude is not between -90 to 90 inclusive, or the longitude is not between -180 to 180 inclusive, none of the values are set and the type() 将是 InvalidCoordinate .

注意: altitude specifies the meters above sea level.

另请参阅

isValid()

PySide2.QtPositioning.QGeoCoordinate. CoordinateType

Defines the types of a coordinate.

常量

描述

QGeoCoordinate.InvalidCoordinate

An invalid coordinate. A coordinate is invalid if its latitude or longitude values are invalid.

QGeoCoordinate.Coordinate2D

A coordinate with valid latitude and longitude values.

QGeoCoordinate.Coordinate3D

A coordinate with valid latitude and longitude values, and also an altitude value.

PySide2.QtPositioning.QGeoCoordinate. CoordinateFormat

Defines the possible formatting options for toString() .

常量

描述

QGeoCoordinate.Degrees

Returns a string representation of the coordinates in decimal degrees format.

QGeoCoordinate.DegreesWithHemisphere

Returns a string representation of the coordinates in decimal degrees format, using ‘N’, ‘S’, ‘E’ or ‘W’ to indicate the hemispheres of the coordinates.

QGeoCoordinate.DegreesMinutes

Returns a string representation of the coordinates in degrees-minutes format.

QGeoCoordinate.DegreesMinutesWithHemisphere

Returns a string representation of the coordinates in degrees-minutes format, using ‘N’, ‘S’, ‘E’ or ‘W’ to indicate the hemispheres of the coordinates.

QGeoCoordinate.DegreesMinutesSeconds

Returns a string representation of the coordinates in degrees-minutes-seconds format.

QGeoCoordinate.DegreesMinutesSecondsWithHemisphere

Returns a string representation of the coordinates in degrees-minutes-seconds format, using ‘N’, ‘S’, ‘E’ or ‘W’ to indicate the hemispheres of the coordinates.

另请参阅

toString()

PySide2.QtPositioning.QGeoCoordinate. altitude ( )
返回类型

double

Returns the altitude (meters above sea level).

The return value is undefined if the altitude has not been set.

PySide2.QtPositioning.QGeoCoordinate. atDistanceAndAzimuth ( distance , azimuth [ , distanceUp=0.0 ] )
参数
  • distance qreal

  • azimuth qreal

  • distanceUp qreal

返回类型

QGeoCoordinate

Returns the coordinate that is reached by traveling distance meters from the current coordinate at azimuth (or bearing) along a great-circle. There is an assumption that the Earth is spherical for the purpose of this calculation.

The altitude will have distanceUp added to it.

Returns an invalid coordinate if this coordinate is invalid.

PySide2.QtPositioning.QGeoCoordinate. azimuthTo ( other )
参数

other QGeoCoordinate

返回类型

qreal

Returns the azimuth (or bearing) in degrees from this coordinate to the coordinate specified by other . Altitude is not used in the calculation.

The bearing returned is the bearing from the origin to other along the great-circle between the two coordinates. There is an assumption that the Earth is spherical for the purpose of this calculation.

Returns 0 if the type of this coordinate or the type of other is InvalidCoordinate .

PySide2.QtPositioning.QGeoCoordinate. distanceTo ( other )
参数

other QGeoCoordinate

返回类型

qreal

Returns the distance (in meters) from this coordinate to the coordinate specified by other . Altitude is not used in the calculation.

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 the type of this coordinate or the type of other is InvalidCoordinate .

PySide2.QtPositioning.QGeoCoordinate. isValid ( )
返回类型

bool

返回 true longitude and latitude are valid.

PySide2.QtPositioning.QGeoCoordinate. latitude ( )
返回类型

double

Returns the latitude, in decimal degrees. The return value is undefined if the latitude has not been set.

A positive latitude indicates the Northern Hemisphere, and a negative latitude indicates the Southern Hemisphere.

PySide2.QtPositioning.QGeoCoordinate. longitude ( )
返回类型

double

Returns the longitude, in decimal degrees. The return value is undefined if the longitude has not been set.

A positive longitude indicates the Eastern Hemisphere, and a negative longitude indicates the Western Hemisphere.

PySide2.QtPositioning.QGeoCoordinate. __ne__ ( other )
参数

other QGeoCoordinate

返回类型

bool

返回 true if latitude, longitude, or altitude of this coordinate are not identical to other .

PySide2.QtPositioning.QGeoCoordinate. __eq__ ( other )
参数

other QGeoCoordinate

返回类型

bool

Returns true if the latitude, longitude and altitude of this coordinate are the same as those of other .

The longitude will be ignored if the latitude is +/- 90 degrees.

PySide2.QtPositioning.QGeoCoordinate. setAltitude ( altitude )
参数

altitude double

Sets the altitude (meters above sea level) to altitude .

另请参阅

altitude()

PySide2.QtPositioning.QGeoCoordinate. setLatitude ( latitude )
参数

latitude double

Sets the latitude (in decimal degrees) to latitude . The value should be in the WGS84 datum.

To be valid, the latitude must be between -90 to 90 inclusive.

另请参阅

latitude()

PySide2.QtPositioning.QGeoCoordinate. setLongitude ( longitude )
参数

longitude double

Sets the longitude (in decimal degrees) to longitude . The value should be in the WGS84 datum.

To be valid, the longitude must be between -180 to 180 inclusive.

另请参阅

longitude()

PySide2.QtPositioning.QGeoCoordinate. toString ( [ format=DegreesMinutesSecondsWithHemisphere ] )
参数

format CoordinateFormat

返回类型

unicode

Returns this coordinate as a string in the specified format .

For example, if this coordinate has a latitude of -27.46758, a longitude of 153.027892 and an altitude of 28.1, these are the strings returned depending on format :

format value

Returned string

Degrees

-27.46758°, 153.02789°, 28.1m

DegreesWithHemisphere

27.46758° S, 153.02789° E, 28.1m

DegreesMinutes

-27° 28.054’, 153° 1.673’, 28.1m

DegreesMinutesWithHemisphere

27° 28.054 S’, 153° 1.673’ E, 28.1m

DegreesMinutesSeconds

-27° 28’ 3.2”, 153° 1’ 40.4”, 28.1m

DegreesMinutesSecondsWithHemisphere

27° 28’ 3.2” S, 153° 1’ 40.4” E, 28.1m

The altitude field is omitted if no altitude is set.

If the coordinate is invalid, an empty string is returned.

PySide2.QtPositioning.QGeoCoordinate. type ( )
返回类型

CoordinateType

Returns the type of this coordinate.