icalendar.prop.geo module#

GEO property values from RFC 5545.

class icalendar.prop.geo.vGeo(geo, /, params=None)[source]#

Bases: object

Geographic position.

This property specifies information related to the global position for the activity specified by a calendar component.

This property value specifies latitude and longitude, in that order. The acceptable ranges are -90.000000 to +90.000000 for latitude and -180.000000 to +180.000000 for longitude. The longitude and latitude values may be specified up to six decimal places, which will allow for accuracy to within one meter of geographical position.

This property can be specified in VEVENT or VTODO calendar components.

Raises:

ValueError – if geo is not a tuple of (latitude, longitude).

Examples

GEO:37.386013;-122.082932

Parse vGeo:

>>> from icalendar.prop import vGeo
>>> geo = vGeo.from_ical('37.386013;-122.082932')
>>> geo
(37.386013, -122.082932)

Add a geographic location to an event:

>>> from icalendar import Event
>>> event = Event()
>>> latitude = 37.386013
>>> longitude = -122.082932
>>> event.add('GEO', (latitude, longitude))
>>> event['GEO']
vGeo((37.386013, -122.082932))
default_value: ClassVar[str] = 'FLOAT'#
classmethod examples()[source]#

Examples of vGeo.

Return type:

list[Self]

static from_ical(ical)[source]#
Return type:

tuple[float, float]

classmethod from_jcal(jcal_property)[source]#

Parse jCal from RFC 7265.

Parameters:

jcal_property (list) – The jCal property to parse.

Raises:

JCalParsingError – If the provided jCal is invalid.

Return type:

Self

classmethod from_xcal(xml)[source]#

Parse xCal according to RFC 6321.

Parameters:
  • parser – Required. The xCal to parse or a parser.

  • params – Required. The parameters of the xCal element.

Raises:

XCalParsingError – If the provided xCal is invalid.

Return type:

VProp

property ical_value: tuple[float, float]#

Geographic position as a tuple of (latitude, longitude) according to RFC 5545 Section 3.8.1.6.

latitude: float#

The latitude of the geo position.

longitude: float#

The longitude of the geo position.

params: Parameters#
to_ical()[source]#
Return type:

str

to_jcal(name)[source]#

Convert to jCal object.

Return type:

list

to_xcal(element)[source]#

Add the xCal representation of this property according to RFC 6321.

Return type:

None