GEO Property

The Geographic Position property is identified by the name GEO. This property specifies information related to the global position of the 'home' system that created the vCalendar or iCalendar object. The property value specifies longitude and latitude. The longitude represents the location east and west of the prime meridian as a positive or negative real number, respectively. The latitude represents the location north and south of the equator as a positive or negative real number, respectively.

The latitude and longitude values may have a maximum precision of up to 6 decimal places, which will be truncated depending on the support by the accepting application.

Latitude values are restricted to be from 0 to 90 and longitude values from 0 to 180. Clients will not be able to specify any value outside of this range.

This GEO property must contain two floating number parameters – one for latitude and the other for the longitude of the entry’s global position.

Here is an example of a GEO property in a vCalendar file:

  • GEO:37.24,-17.87

Here are examples of GEO property in an iCalendar file:

  • GEO:37.386013;-122.082932

  • GEO:28.55;36.22

  • GEO:-43.003241;-161.039483

As can be seen, there is a subtle difference in the way the GEO property is displayed between the iCalendar and vCalendar specifications. The delimiter is a semi-colon in iCalendar as opposed to a comma in vCalendar.

Setting a GEO Property

CCalGeoValue::SetLatLongL(const TReal& aLatitude, const TReal& aLongitude) sets the latitude and longitude positions for the geographical location.

aLatitude stores the latitude in degrees. Minutes are represented as a decimal fraction, rounded to 6 decimal places. Latitude may range from -90 to 90. A positive latitude indicates a position north of the equator, while a negative latitude is south of it.

aLongitude stores the longitude in degrees. Minutes are represented as a decimal fraction rounded to 6 decimal places. Longitude ranges from -180 to 180. A positive longitude indicates a position east of the prime meridian, while a negative longitude is a position west of it.

KErrArgument error occurs if the latitude or longitude is out of range

Getting a GEO Property

CCalGeoValue::GetLatLong(TReal& aLatitude, TReal& aLongitude) gets the latitude and longitude positions for the geographical location.

On return, aLatitude contains the value of the latitude in degrees. Minutes are represented as a decimal fraction. Latitude may be from -90 to 90. A positive latitude indicates a position north of the equator.

On return, aLongitude contains the value of the longitude in degrees. Minutes are represented as a decimal fraction. Longitude may be from -180 to 180. A positive longitude indicates a position east of the prime meridian.

EFalse is returned if the latitude and longitude have not been set on this object. ETrue is returned if they have been set and are both valid.

Setting a Geographic Location

Once a geographical location object (CCalGeoValue) has been created, CCalEntry::SetGeoValueL(const CCalGeoValue& aGeoValue) sets the geographic location for this entry. This is known as the GEO property in vCalendar and iCalendar. Note that if the latitude and longitude are not set, then the GEO property will be reset on this entry.

Getting a Geographic Location

CCalEntry::GeoValueL() gets the geographic location for this entry, known as the GEO property in vCalendar and iCalendar (RFC 2445). It returns a new CCalGeoValue object which contains the geographic location.

A geographical location object (CCalGeoValue) is now created, containing the entry's GEO values if they are present. If they are not present, nothing happens and NULL is returned.