KDE 4.7 PyKDE API Reference

- KDE's Python API

# 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
Notation | { Decimal, DMS }
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)
| detach (self)
int | detail (self)
| geoCoordinates (self, float lon, float lat, Marble.GeoDataCoordinates.Unit unit=Marble.GeoDataCoordinates.Radian)
| geoCoordinates (self, float lon, float lat, float alt, Marble.GeoDataCoordinates.Unit unit=GeoDataCoordinates.Radian)
bool | isPole (self, Marble.Pole a0=Marble.AnyPole)
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 ) |

__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

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)

geoCoordinates | ( | self, |
|  | float | lon,
|  | float | lat,
|  | float | alt,
|  | Marble.GeoDataCoordinates.Unit | unit=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.

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

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 |

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 |