KDE 4.9 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

GeoDataCoordinates Class Reference

from PyKDE4.marble import *

Namespace: Marble

Detailed Description

A 3d point representation

GeoDataCoordinates is the simple representation of a single three dimensional point. It can be used all through out marble as the data type for three dimensional objects. it comprises of a Quaternion for speed issues. This class was introduced to reflect the difference between a simple 3d point and the GeoDataGeometry object containing such a point. The latter is a GeoDataPoint and is simply derived from GeoDataCoordinates.

See also:
GeoDataPoint


Enumerations

BearingType { InitialBearing, FinalBearing }
Notation { Decimal, DMS, DM }
Unit { Radian, Degree }

Methods

 __init__ (self, Marble.GeoDataCoordinates other)
 __init__ (self)
 __init__ (self, float lon, float lat, float alt=0, Marble.GeoDataCoordinates.Unit unit=Marble.GeoDataCoordinates.Radian, int detail=0)
float altitude (self)
float bearing (self, Marble.GeoDataCoordinates other, Marble.GeoDataCoordinates.Unit unit=Marble.GeoDataCoordinates.Radian, Marble.GeoDataCoordinates.BearingType type=Marble.GeoDataCoordinates.InitialBearing)
 detach (self)
int detail (self)
 geoCoordinates (self, float lon, float lat, Marble.GeoDataCoordinates.Unit unit=Marble.GeoDataCoordinates.Radian)
bool isPole (self, Marble.Pole a0=Marble.AnyPole)
bool isValid (self)
QString latToString (self)
float latitude (self, Marble.GeoDataCoordinates.Unit unit=Marble.GeoDataCoordinates.Radian)
QString lonToString (self)
float longitude (self, Marble.GeoDataCoordinates.Unit unit=Marble.GeoDataCoordinates.Radian)
bool operator != (self, Marble.GeoDataCoordinates a0)
bool operator == (self, Marble.GeoDataCoordinates a0)
 pack (self, QDataStream stream)
Marble.Quaternion quaternion (self)
 set (self, float lon, float lat, float alt=0, Marble.GeoDataCoordinates.Unit unit=Marble.GeoDataCoordinates.Radian)
 setAltitude (self, float altitude)
 setDetail (self, int det)
 setLatitude (self, float lat, Marble.GeoDataCoordinates.Unit unit=Marble.GeoDataCoordinates.Radian)
 setLongitude (self, float lon, Marble.GeoDataCoordinates.Unit unit=Marble.GeoDataCoordinates.Radian)
QString toString (self)
QString toString (self, Marble.GeoDataCoordinates.Notation notation, int precision=-1)
 unpack (self, QDataStream stream)

Static Methods

Marble.GeoDataCoordinates.Notation defaultNotation ()
Marble.GeoDataCoordinates fromString (QString string, bool successful)
QString latToString (float lat, Marble.GeoDataCoordinates.Notation notation, Marble.GeoDataCoordinates.Unit unit=Marble.GeoDataCoordinates.Radian, int precision=-1, QString format='f')
QString lonToString (float lon, Marble.GeoDataCoordinates.Notation notation, Marble.GeoDataCoordinates.Unit unit=Marble.GeoDataCoordinates.Radian, int precision=-1, QString format='f')
float normalizeLat (float lat, Marble.GeoDataCoordinates.Unit a1=Marble.GeoDataCoordinates.Radian)
float normalizeLon (float lon, Marble.GeoDataCoordinates.Unit a1=Marble.GeoDataCoordinates.Radian)
 normalizeLonLat (float lon, float lat, Marble.GeoDataCoordinates.Unit a2=Marble.GeoDataCoordinates.Radian)
 setDefaultNotation (Marble.GeoDataCoordinates.Notation notation)

Method Documentation

__init__ (  self,
Marble.GeoDataCoordinates  other
)
__init__ (   self )

constructs an invalid instance

Constructs an invalid instance such that calling isValid() on it will return

 false @endcode.

__init__ (  self,
float  lon,
float  lat,
float  alt=0,
Marble.GeoDataCoordinates.Unit  unit=Marble.GeoDataCoordinates.Radian,
int  detail=0
)

create a geocoordinate from longitude and latitude

Parameters:
_lon  longitude
_lat  latitude
alt  altitude in meters (default: 0)
_unit  units that lon and lat get measured in (default for Radian: north pole at pi/2, southpole at -pi/2)
_detail  detail (default: 0)

float altitude (   self )

return the altitude of the Point in meters

float bearing (  self,
Marble.GeoDataCoordinates  other,
Marble.GeoDataCoordinates.Unit  unit=Marble.GeoDataCoordinates.Radian,
Marble.GeoDataCoordinates.BearingType  type=Marble.GeoDataCoordinates.InitialBearing
)

Returns the bearing (true bearing, the angle between the line defined by this point and the other and the prime meridian)

Parameters:
other  The second point that, together with this point, defines a line
unit  Unit of the result

Returns:
The true bearing in the requested unit, not range normalized, in clockwise direction, with the value 0 corresponding to north

detach (   self )
int detail (   self )

return the detail flag

geoCoordinates (  self,
float  lon,
float  lat,
Marble.GeoDataCoordinates.Unit  unit=Marble.GeoDataCoordinates.Radian
)

use this function to get the longitude, latitude and altitude with one call - use the unit parameter to switch between Radian and DMS

Parameters:
lon  longitude
lat  latitude
alt  altitude in meters
unit  units that lon and lat get measured in (default for Radian: north pole at pi/2, southpole at -pi/2)

bool isPole (  self,
Marble.Pole  a0=Marble.AnyPole
)

return whether our coordinates represent a pole This method can be used to check whether the coordinate equals one of the poles.

bool isValid (   self )

Returns

 true @endcode if the coordinate is valid, 
 false @endcode otherwise.
 @return whether the coordinate is valid

 A coordinate is valid, if at least one component has been set and the last
 assignment was not an invalid GeoDataCoordinates object.

QString latToString (   self )

return a string representation of latitude of the coordinate convenience function that uses the default notation

float latitude (  self,
Marble.GeoDataCoordinates.Unit  unit=Marble.GeoDataCoordinates.Radian
)

retrieves the latitude of the GeoDataCoordinates object use the unit parameter to switch between Radian and DMS

Parameters:
unit  units that lon and lat get measured in (default for Radian: north pole at pi/2, southpole at -pi/2)

Returns:
latitude

QString lonToString (   self )

return a string representation of longitude of the coordinate convenience function that uses the default notation

float longitude (  self,
Marble.GeoDataCoordinates.Unit  unit=Marble.GeoDataCoordinates.Radian
)

retrieves the longitude of the GeoDataCoordinates object use the unit parameter to switch between Radian and DMS

Parameters:
unit  units that lon and lat get measured in (default for Radian: north pole at pi/2, southpole at -pi/2)

Returns:
longitude

bool operator != (  self,
Marble.GeoDataCoordinates  a0
)
bool operator == (  self,
Marble.GeoDataCoordinates  a0
)
pack (  self,
QDataStream  stream
)

Serialize the contents of the feature to stream.

Marble.Quaternion quaternion (   self )

return a Quaternion with the used coordinates

set (  self,
float  lon,
float  lat,
float  alt=0,
Marble.GeoDataCoordinates.Unit  unit=Marble.GeoDataCoordinates.Radian
)

(re)set the coordinates in a GeoDataCoordinates object

Parameters:
_lon  longitude
_lat  latitude
alt  altitude in meters (default: 0)
_unit  units that lon and lat get measured in (default for Radian: north pole at pi/2, southpole at -pi/2)

setAltitude (  self,
float  altitude
)

set the altitude of the Point in meters

Parameters:
altitude  altitude

setDetail (  self,
int  det
)

set the detail flag

Parameters:
det  detail

setLatitude (  self,
float  lat,
Marble.GeoDataCoordinates.Unit  unit=Marble.GeoDataCoordinates.Radian
)

set the longitude in a GeoDataCoordinates object

Parameters:
_lat  longitude
_unit  units that lon and lat get measured in (default for Radian: north pole at pi/2, southpole at -pi/2)

setLongitude (  self,
float  lon,
Marble.GeoDataCoordinates.Unit  unit=Marble.GeoDataCoordinates.Radian
)

set the longitude in a GeoDataCoordinates object

Parameters:
_lon  longitude
_unit  units that lon and lat get measured in (default for Radian: north pole at pi/2, southpole at -pi/2)

QString toString (   self )

return a string with the notation given by notation

Parameters:
notation  set a notation different from the default one
precision  set the number of digits below degrees. The precision depends on the current notation: For Decimal representation the precision is the number of digits after the decimal point. In DMS a precision of 1 or 2 shows the arc minutes; a precision of 3 or 4 will show arc seconds. A precision beyond that will increase the number of digits after the arc second decimal point.

QString toString (  self,
Marble.GeoDataCoordinates.Notation  notation,
int  precision=-1
)

return a string with the notation given by notation

Parameters:
notation  set a notation different from the default one
precision  set the number of digits below degrees. The precision depends on the current notation: For Decimal representation the precision is the number of digits after the decimal point. In DMS a precision of 1 or 2 shows the arc minutes; a precision of 3 or 4 will show arc seconds. A precision beyond that will increase the number of digits after the arc second decimal point.

unpack (  self,
QDataStream  stream
)

Unserialize the contents of the feature from stream.


Static Method Documentation

Marble.GeoDataCoordinates.Notation defaultNotation (   )

return Notation of string representation

Marble.GeoDataCoordinates fromString ( QString  string,
bool  successful
)

try to parse the string into a coordinate pair

Parameters:
successful  becomes true if the conversion succeeds

Returns:
the geodatacoordinates

QString latToString ( float  lat,
Marble.GeoDataCoordinates.Notation  notation,
Marble.GeoDataCoordinates.Unit  unit=Marble.GeoDataCoordinates.Radian,
int  precision=-1,
QString  format='f'
)

return a string representation of latitude of the coordinate convenience function that uses the default notation

QString lonToString ( float  lon,
Marble.GeoDataCoordinates.Notation  notation,
Marble.GeoDataCoordinates.Unit  unit=Marble.GeoDataCoordinates.Radian,
int  precision=-1,
QString  format='f'
)

return a string representation of longitude of the coordinate convenience function that uses the default notation

float normalizeLat ( float  lat,
Marble.GeoDataCoordinates.Unit  a1=Marble.GeoDataCoordinates.Radian
)

normalize latitude to always be in -3.14159265358979323846264338327950288419717 / 2. <= lat <= +3.14159265358979323846264338327950288419717 / 2 (Radian).

Parameters:
lat  latitude

float normalizeLon ( float  lon,
Marble.GeoDataCoordinates.Unit  a1=Marble.GeoDataCoordinates.Radian
)

normalize the longitude to always be -3.14159265358979323846264338327950288419717 <= lon <= +3.14159265358979323846264338327950288419717 (Radian).

Parameters:
lon  longitude

normalizeLonLat ( float  lon,
float  lat,
Marble.GeoDataCoordinates.Unit  a2=Marble.GeoDataCoordinates.Radian
)

normalize both longitude and latitude at the same time This method normalizes both latitude and longitude, so that the latitude and the longitude stay within the "usual" range. NOTE: If the latitude exceeds 3.14159265358979323846264338327950288419717/2 (+90.0 deg) or -3.14159265358979323846264338327950288419717/2 (-90.0 deg) then this will be interpreted as a pole traversion where the point will end up on the opposite side of the globe. Therefore the longitude will change by 3.14159265358979323846264338327950288419717 (180 deg). If you don't want this behaviour use both normalizeLat() and normalizeLon() instead.

Parameters:
lon  the longitude value
lat  the latitude value

setDefaultNotation ( Marble.GeoDataCoordinates.Notation  notation
)

set the Notation of the string representation

Parameters:
notation  Notation


Enumeration Documentation

BearingType

The BearingType enum specifies where to measure the bearing along great circle arcs

When travelling along a great circle arc defined by the two points A and B, the bearing varies along the arc. The "InitialBearing" bearing corresponds to the bearing value at A, the "FinalBearing" bearing to that at B.

Enumerator:
InitialBearing 
FinalBearing 

Notation

enum used to specify the notation / numerical system

For degrees there exist two notations: "Decimal" (base-10) and the "Sexagesimal DMS" (base-60) which is traditionally used in cartography. Decimal notation uses floating point numbers to specify parts of a degree. The Sexagesimal DMS notation uses integer based Degrees-(Arc)Minutes-(Arc)Seconds to describe parts of a degree.

Enumerator:
Decimal 
DMS 
DM 

Unit

enum used constructor to specify the units used

Internally we always use radian for mathematical convenience. However the Marble's interfaces to the outside should default to degrees.

Enumerator:
Radian 
Degree 

  • Full Index

Modules

  • akonadi
  • dnssd
  • kdecore
  • kdeui
  • khtml
  • kio
  • knewstuff
  • kparts
  • kutils
  • nepomuk
  • phonon
  • plasma
  • polkitqt
  • solid
  • soprano
This documentation is maintained by Simon Edwards.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal