LGV_TZ_Lookup 1.4.2
Time zone lookup for PHP applications and HTTP clients
Loading...
Searching...
No Matches
LGV_TZ_Lookup_Query Class Reference

Public Member Functions

 __construct ($inDBObject)
 get_tz ( $in_lng, $in_lat)

Public Attributes

 $db_object

Private Member Functions

 _find_in_polygons ($candidates, $longitude, $latitude)

Static Private Member Functions

static _wn_PackedPoly ($longitude, $latitude, $polygon)

Detailed Description

This class is a lookup class.

It queries the database, and returns the timezone that corresponds to the provided longitude, latitude pair.

Definition at line 40 of file LGV_TZ_Lookup_Query.class.php.

Constructor & Destructor Documentation

◆ __construct()

LGV_TZ_Lookup_Query::__construct ( $inDBObject)

The constructor.

Parameters
$inDBObjectAn initialized database instance for this handler.

Definition at line 51 of file LGV_TZ_Lookup_Query.class.php.

Member Function Documentation

◆ _find_in_polygons()

LGV_TZ_Lookup_Query::_find_in_polygons ( $candidates,
$longitude,
$latitude )
private

Fetch compact polygons and stop at the first match, without expanding all candidates into PHP point arrays.

Definition at line 98 of file LGV_TZ_Lookup_Query.class.php.

Referenced by get_tz().

Here is the caller graph for this function:

◆ _wn_PackedPoly()

LGV_TZ_Lookup_Query::_wn_PackedPoly ( $longitude,
$latitude,
$polygon )
staticprivate

The winding-number algorithm courtesy of San Zhujun (https://gist.github.com/zhujunsan/81d6a2f05d590f618a5ad36f25666fc2), operating on the existing packed native-double format with the same edge/vertex comparisons. Decode 1,024 points at a time: per-point unpack calls are expensive, while unpacking an entire large polygon creates a large PHP hash table. Carry the preceding point across blocks, including the closing edge.

Definition at line 119 of file LGV_TZ_Lookup_Query.class.php.

◆ get_tz()

LGV_TZ_Lookup_Query::get_tz ( $in_lng,
$in_lat )

This queries the database, and returns the TZ.

Returns
: A string, with the timezone. Empty, if none.
Parameters
$in_lngThe longitude
$in_latThe latitude

Definition at line 62 of file LGV_TZ_Lookup_Query.class.php.

References _find_in_polygons().

Here is the call graph for this function:

Member Data Documentation

◆ $db_object

LGV_TZ_Lookup_Query::$db_object

The database object we're accessing.

Definition at line 45 of file LGV_TZ_Lookup_Query.class.php.


The documentation for this class was generated from the following file: