All Projects β†’ evansiroky β†’ Timezone Boundary Builder

evansiroky / Timezone Boundary Builder

Licence: other
A tool to extract data from Open Street Map (OSM) to build the boundaries of the world's timezones.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Timezone Boundary Builder

orange3-geo
🍊 🌍 Orange add-on for dealing with geography and geo-location
Stars: ✭ 22 (-95.31%)
Mutual labels:  maps, openstreetmap
maps4cim
maps4cim - a real world map generator for CiM 2
Stars: ✭ 21 (-95.52%)
Mutual labels:  maps, openstreetmap
s60-maps
Yet another maps for Symbian OS
Stars: ✭ 27 (-94.24%)
Mutual labels:  maps, openstreetmap
Mapbox Gl Native
Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
Stars: ✭ 4,091 (+772.28%)
Mutual labels:  maps, openstreetmap
Offroad-routing-engine
Off-road Navigation System
Stars: ✭ 16 (-96.59%)
Mutual labels:  maps, openstreetmap
GPXSee-maps
GPXSee maps
Stars: ✭ 27 (-94.24%)
Mutual labels:  maps, openstreetmap
organicmaps
πŸƒ Organic Maps is a free Android & iOS offline maps app for travelers, tourists, hikers, and cyclists. It uses crowd-sourced OpenStreetMap data and is developed with love by MapsWithMe (MapsMe) founders and our community. No ads, no tracking, no data collection, no crapware. Your donations and positive reviews motivate and inspire our small team!
Stars: ✭ 3,689 (+686.57%)
Mutual labels:  maps, openstreetmap
openstreetmap-carto-vector-tiles
A general-purpose OpenStreetMap mapnik style, in CartoCSS, served with vector tiles
Stars: ✭ 46 (-90.19%)
Mutual labels:  maps, openstreetmap
bexhill-osm
A local mapping project using data from OpenStreetMap. Includes overlays, walking directions and historical information.
Stars: ✭ 16 (-96.59%)
Mutual labels:  maps, openstreetmap
o.map
Open Street Map app - KaiOS
Stars: ✭ 51 (-89.13%)
Mutual labels:  maps, openstreetmap
timeshape
Java library to find timezone based on geo coordinates
Stars: ✭ 116 (-75.27%)
Mutual labels:  openstreetmap, timezone
Osmnx
OSMnx: Python for street networks. Retrieve, model, analyze, and visualize street networks and other spatial data from OpenStreetMap.
Stars: ✭ 3,357 (+615.78%)
Mutual labels:  maps, openstreetmap
openstreetmap-americana
A quintessentially American map style
Stars: ✭ 89 (-81.02%)
Mutual labels:  maps, openstreetmap
trackanimation
Track Animation is a Python 2 and 3 library that provides an easy and user-adjustable way of creating visualizations from GPS data.
Stars: ✭ 74 (-84.22%)
Mutual labels:  maps, openstreetmap
osm-static-maps
Openstreetmap static maps is a nodejs lib, CLI and server open source inspired on google static map service
Stars: ✭ 130 (-72.28%)
Mutual labels:  maps, openstreetmap
osm-geojson
πŸ”° Get GeoJSON of a OpenStreetMap's relation from the API.
Stars: ✭ 42 (-91.04%)
Mutual labels:  maps, openstreetmap
planetiler
Flexible tool to build planet-scale vector tilesets from OpenStreetMap data fast
Stars: ✭ 823 (+75.48%)
Mutual labels:  maps, openstreetmap
osm-extracts
Each day, OSM Extracts by Interline mirrors the entire OpenStreetMap planet and creates city and region sized extracts
Stars: ✭ 34 (-92.75%)
Mutual labels:  maps, openstreetmap
mapus
A map tool with real-time collaboration πŸ—ΊοΈ
Stars: ✭ 2,687 (+472.92%)
Mutual labels:  maps, openstreetmap
map-machine
Python renderer for OpenStreetMap with custom icons intended to display as many map features as possible
Stars: ✭ 82 (-82.52%)
Mutual labels:  maps, openstreetmap

Timezone Boundary Builder

The goal of this project is to produce a shapefile with the boundaries of the world's timezones using OpenStreetMap data.

Github downloads for all releases GitHub release

Shapefiles and data

The shapefiles are available for download in this project's releases. As of release 2018d shapefiles are available with or without oceans. Each shape or geojson object has a single attribute or property respectively called tzid. The tzid corresponds to the timezone name as defined in the timezone database (for example: America/Los_Angeles or Asia/Shanghai).

This project aims to stay up-to-date with all of the currently valid timezones that are defined in the timezone database. This project also will attempt to provide the most accurate possible boundaries of timezones according to community input.

The underlying data is downloaded from OpenStreetMap via the overpass turbo API. Various boundaries are assembled together to produce each zone with various geographic operations. In numerous edge cases arbitrary boundaries get created in various zones which are noted in the timezones.json file.

To maintain consistency with the timezone database, this project will only create a new release after the timezone database creates a new release. If there are no new timezones created or deleted in a timezone database release, then this project will only create a release if there have been changes performed to the boundary definitions of an existing zone within this project.

Lookup Libraries

A few common languages already have libraries with an API that can be used to lookup the timezone name at a particular GPS coordinate. Here are some libraries that use the data produced by timezone-boundary-builder:

Library Language
ZoneDetect C
go-tz Go
timezoneLookup Go
TimeZoneMap Java & Android
Timeshape Java
node-geo-tz JavaScript (node.js only)
timespace JavaScript (node.js and in browser)
tz-lookup JavaScript (node.js and in browser)
GeoTimezone .NET
Geo-Timezone php
timezonefinder Python
lutz R

Another common way to use the data for lookup purposes is to load the shapefile into a spatially-aware database. See this blog post for an example of how that can be done.

Running the script

If the data in the releases are not sufficiently recent or you want to build the latest from master, it is possible to run the script to generate the timezones. However, due to the ever-changing nature of OpenStreetMap, the script should be considered unstable. The script frequently breaks when unexpected data is received or changes in OpenStreetMap cause validation issues. Please see the troubleshooting guide for help with common errors.

Run the script to generate timezones for all timezones.

node --max-old-space-size=8192 index.js

Run the script to generate timezones for only specified timezones.

node --max-old-space-size=8192 index.js --included_zones America/New_York America/Chicago

Run the script to generate timezones while excluding specified timezones.

node --max-old-space-size=8192 index.js --excluded_zones America/New_York America/Chicago

Run the script with custom working / output directories.

timezone-boundary-builder downloads boundaries from OpenStreetMap and places them in the ./downloads directory by default. It generates output files in the ./dist directory by default.

If you want to use different directories, you can do so with the --downloads_dir and --dist_dir flags.

node --max-old-space-size=8192 index.js --downloads_dir ./downloads2 --dist_dir ./dist2

Other command line flags

Other command line flags:

  • --help - show some basic usage information
  • --skip_analyze_diffs - do not analyze differences between the current output and another version
  • --skip_shapefile - do not create the shapefile from the geojson file
  • --skip_validation - do not validate the time zone boundaries
  • --skip_zip - do not zip the generated geojson files

What the script does

There are three config files that describe the boundary building process. The osmBoundarySources.json file lists all of the needed boundaries to extract via queries to the Overpass API. The timezones.json file lists all of the timezones and various operations to perform to build the boundaries. The expectedZoneOverlaps.json file lists all timezones that are allowed to overlap each other and the acceptable bounds of a particular overlap.

The index.js file downloads all of the required geometries, builds the specified geometries, validates that there aren't large areas of overlap (other than those that are expected), analyzes the difference between the current output and the last release, outputs one huge geojson file, and finally zips up the geojson file using the zip cli and also converts the geojson to a shapefile using the ogr2ogr cli. The script has only been verified to run with Node.js 10 on the MacOS platform.

The code does query the publicly available Overpass API, but it self-throttles the making of requests to have a minimum of 4 seconds gap between requests. If the Overpass API throttles the download, then the gap will be increased exponentially.

The validation and difference analysis can take a really long time to compute. If these tasks are not needed, be sure to add the --skip_analyze_diffs and --skip_validation flags.

As of release 2020a, it is possible to run the script with the underlying input data that was used to build the timezone geometries at the time of the release. In the release files, the input-data.zip will have all of the necessary input data including the downloaded files from overpass, the timezones.json file and the osmBoundarySources.json file as well.

Limitations of this project

The data is almost completely comprised of OpenStreetMap data which is editable by anyone. There are a few guesses on where to draw an arbitrary border in the open waters and a few sparsely inhabited areas. Some uninhabited islands are omitted from this project. This project does include timezones in the oceans, but strictly uses territorial waters or Etc/GMT timezones instead of unofficially observed areas such as Exclusive Economic Zones.

Contributing

Pull requests are welcome! Please follow the guidelines listed below:

Improvements to code

Will be approved subject to code review.

Changes to timezone boundary configuration

Any change to the boundary of existing timezones must have some explanation of why the change is necessary. If there are official, publicly available documents of administrative areas describing their timezone boundary please link to them when making your case. All changes involving an administrative area changing their observed time should instead be sent to the timezone database.

A linting script will verify the integrity of the timezones.json, osmBoundarySources.json and expectedZoneOverlaps.json files. The script verifies if all needed overpass sources are properly defined and that there aren't any unneeded overpass downloads. If an operation to make a timezone boundary requires the use of a manual geometry, a description must be added explaining the operation. All expected zone overlaps must have a description.

Thanks

Thanks to following people whose open-source and open-data contributions have made this project possible:

Licenses

The code used to construct the timezone boundaries is licensed under the MIT License.

The outputted data is licensed under the Open Data Commons Open Database License (ODbL).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].