---
title: client.geo.latitude
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/variables/geolocation/client-geo-latitude
---

**Type:** FLOAT  
**Access:** read-only

**Available in:** all subroutines

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](https://en.wikipedia.org/wiki/World_Geodetic_System) coordinate 
reference system.

## Example

An example showing construction of a [geo URI](https://en.wikipedia.org/wiki/Geo_URI_scheme)
as specified by [RFC 5870](https://tools.ietf.org/html/rfc5870) in VCL:

```vcl
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).

## Example

Here's an example showing classification to the five main
[Geographical zones](https://en.wikipedia.org/wiki/Geographical_zone) in VCL
(latitude values as of Oct 2018):

```vcl
sub client_geo_zone STRING {
  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";
  }

  return var.zone;
}
```

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

```vcl
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](https://en.wikipedia.org/wiki/Prime_(symbol)), not quotes.
