mikljacq / timezone_finder

A Dart library that finds the time zone name (according to the IANA time zone database) for any position on Earth given by latitude and longitude coordinates in degrees.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A Dart library that finds the time zone name for any position on Earth given by latitude and longitude coordinates in degrees.

The name of the time zone found corresponds to the time zone name as defined in the IANA timezone database (for example: Europe/Madrid or Asia/Shanghai).

The boundaries of the world's time zones used to perform the search have been compiled by the Timezone Boundary Builder from Evan Siroky.

Limitations

The limitations are the same as the Timezone Boundary Builder project.

Performances

The size of the database is about 150 Mo and as there is a huge amount of polygons to parse and as the current version does not use a spatial-aware database, it takes between 3 and 5 seconds to find the time zone name.

At the very first call, it might take more time because the database needs to be decompressed.

Usage

import 'package:timezone_finder/timezone_finder.dart';

void main() async {
  final latitude = 41.29708;
  final longitude = 2.07846;

  final timezoneFinder = TimezoneFinder();
  final timezoneName = await timezoneFinder.findTimezoneName(latitude, longitude);
  print(timezoneName); // Europe/Madrid
}

About

A Dart library that finds the time zone name (according to the IANA time zone database) for any position on Earth given by latitude and longitude coordinates in degrees.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Dart 100.0%