Skip to content
/ tzf_d Public

Get timezone via longitude&latitude with D in a fast way

License

Notifications You must be signed in to change notification settings

cyrusmsk/tzf_d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Timezone finder

This is a D port of tzf-rs tool. It allows to get the time zone based on the coord data (longitude, latitude).

Build

This is going to be normal dub package.

Dependencies

To get the CLI tool:

dub fetch tzf_d

To build it locally (require D compiler) you can clone the repo and use command:

dub build -b=release

Usage example

To get the result you need to provide (longitude, latitude) as shown below:

tzf_d --lng=100.123 --lat=-42.123

Because of regression in D compiler, currently code is working only with dmd 2.103/ ldc 1.33.

Structure of the project

├── Readme.md
├── data
│   ├── combined-with-oceans.reduce.compress.pb
│   ├── combined-with-oceans.reduce.pb
│   └── combined-with-oceans.reduce.preindex.pb
├── dub.json
└── source
    ├── app.d
    ├── geomedry.d
    ├── lib.d
    ├── package.d
    ├── pb
    │   └── tzinfo.d
    └── tzf_rel.d
  • data: has data files, that will be used to match time zone
  • source/app.d: CLI code
  • source/geomedry.d: library with geometry primitives (could be used separatly)
  • source/lib.d: main library code with internal classes and logic
  • source/pb/tzinfo.d: structure description generated by protoc
  • source/tzf_rel.d: separate file to load data

Todo

  • Make code more iDiomatic
  • Fix dub configuration, to make code available as both CLI and D library
  • Improve performance
  • Reduce copy of the data (adding ref and other attributes)
  • struct vs class
  • make protobuf generation automatically in dub
  • consider code that download only required data, instead of storing all data in the package (~18Mb)
  • Improve CLI functionality: add help and proper args parsing (maybe with commandr)

References

LICENSE

This project is licensed under the MIT license. The data is licensed under the ODbL license, same as evansiroky/timezone-boundary-builder