TzWord v0.3.0 TzWorld View Source
Resolve a timezone name from coordinates.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Callback implementation for GenServer.handle_continue/2
.
Callback implementation for GenServer.init/1
.
Reload the timezone geo JSON data.
Returns the timezone name for the given coordinates specified
as either a Geo.Point
or as lng
and lat
parameters
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Callback implementation for GenServer.handle_continue/2
.
Callback implementation for GenServer.init/1
.
Reload the timezone geo JSON data.
This allows for the data to be reloaded, typically with a new release, without restarting the application.
timezone_at(point)
View Sourcetimezone_at(Geo.Point.t()) :: {:ok, String.t()} | {:error, String.t()}
timezone_at(Geo.PointZ.t()) :: {:ok, String.t()} | {:error, String.t()}
Returns the timezone name for the given coordinates specified
as either a Geo.Point
or as lng
and lat
parameters
Examples
iex> TzWorld.timezone_at(%Geo.Point{coordinates: {3.2, 45.32}})
{:ok, "Europe/Paris"}
iex> TzWorld.timezone_at(3.2, 45.32)
{:ok, "Europe/Paris"}
The algorithm starts by filtering out timezones whose bounding box does not contain the given point.
Once filtered, the first timezone which contains the given
point is returned, or nil
if none of the timzones match.