We've been making changes to how we organize and display our docs. Our work isn't done but we'd love your feedback.

client.geo.latitude

Latitude, in units of degrees from the equator. Values range from -90 to +90 inclusive, with the exception of the special value 999.9 used to indicate absent data.

The latitude given is based on the WGS 84 coordinate reference system.

Examples

An example showing construction of a geo URI as specified by RFC 5870 in VCL:

1
2
declare local var.geouri STRING;
set var.geouri = "geo:" + client.geo.latitude + "," + client.geo.longitude;

This produces a URI of the form geo:37.786971,-122.399677 (where WGS 84 is the default CRS).

Here's an example showing classification to the five main geographical zones in VCL (latitude values as of October 2018):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
declare local var.zone STRING;
if (client.geo.latitude == 999.9) {
  set var.zone = "";
} else if (client.geo.latitude >= 66.5) { # Arctic circle
  set var.zone = "North frigid";
} else if (client.geo.latitude >= 23.5) { # Topic of Cancer
  set var.zone = "North temperate";
} else if (client.geo.latitude <= -66.5) { # Antarctic Circle
  set var.zone = "South frigid";
} else if (client.geo.latitude <= -23.5) { # Tropic of Capricorn
  set var.zone = "South temperate";
} else {
  set var.zone = "Torrid";
}

You can use VCL to convert to degrees, minutes and seconds:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
declare local var.deg INTEGER;
declare local var.min INTEGER;
declare local var.sec FLOAT;

declare local var.angle FLOAT;
declare local var.whole FLOAT;
declare local var.frac FLOAT;

set var.angle = client.geo.latitude; # input
if (var.angle < 0.0) {
  set var.angle *= -1;
}

set var.frac = var.angle;
set var.whole = var.frac;
set var.frac %= 1.0;
set var.whole -= var.frac;
set var.deg = var.whole; # truncated, integer by rounding

set var.frac *= 60.0;
set var.whole = var.frac;
set var.frac %= 1.0;
set var.whole -= var.frac;
set var.min = var.whole; # truncated, integer by rounding

set var.sec = var.frac;
set var.sec *= 60.0; # floating seconds

log client.geo.latitude + " = " + var.deg "° " var.min "" var.sec ""
  + if (client.geo.latitude < 0.0, "S", "N");

For example, a latitude of 59.926 produces 59° 55′ 33.600″ N. The and symbols are Unicode prime symbols, not quotes.

Type

FLOAT

Accessibility

Read Only

Readable From

All subroutines