geostat/README.md

129 wiersze
6.4 KiB
Markdown

2019-09-08 16:42:10 +00:00
GEOSTAT
=======
Tools for computing various statistics related to Geocaching/Opencaching
------------------------------------------------------------------------
2021-04-20 14:35:18 +00:00
# Sample web interface
2020-01-01 23:12:51 +00:00
A sample web interface to play with the tool is available at http://tomaszg.pl/geo/.
2021-04-20 14:35:18 +00:00
# Usage
2019-09-08 16:42:10 +00:00
2020-01-25 11:07:29 +00:00
The main tool is called `geostat`. It is able to access `opencaching.pl` via `OKAPI` or from local database dump maintained by `geodb`. It can also partially read `GPX` files, e.g. exported from [c:geo](https://www.cgeo.org/). It produces various statistics (either as text output with `geostat_cli`, or in a HTML form with `geostat`) and renders a heat map of found/not found caches in a selected region. HTML output requires a style sheet. Sample one is included as `geo.css`.
2019-11-18 15:06:20 +00:00
2019-09-08 16:42:10 +00:00
```
2020-01-25 11:07:29 +00:00
Usage: geostat [options]
Generate HTML stats from Opencaching data or GPX files.
2019-09-08 16:42:10 +00:00
* Data sources:
-o[user] use Opencaching; if specified user will be a user name used for all OC instances
-p user user for opencaching.pl
-d user user for opencaching.de
-u user user for opencaching.us
-n user user for opencaching.nl
-r user user for opencaching.ro
-k user user for opencaching.uk
-q use local SQLite file with dump of OC database
-i timestamp start date
-f timestamp finish date
2019-09-08 16:42:10 +00:00
* Output:
-N compute stats only for unfound caches (works only with SQLite)
2020-08-28 15:35:19 +00:00
-O compute stats only for owned caches (works only with SQLite)
-Q exclude quiz caches from unfound caches
-H file render a heat map to a file
-s n stamp size for a heat map (default = 15)
-e use exponential to flatten the heat map
-t draw trail instead of heat map
-a draw animated map instead of heat map
2020-01-25 11:37:00 +00:00
-m map chosen map: Poland, Poland_relief, Poland_big, Europe, World or a name of voivodeship (default = Poland)
-h display this help screen
2019-09-08 16:42:10 +00:00
```
2021-04-20 14:35:18 +00:00
# Other tools
## geodb
2019-11-18 15:06:20 +00:00
There is a helper program `geodb` which manages local SQLite database. It can initialize the database from full data dump or update it according to changelogs grabbed from OKAPI.
2019-11-04 20:14:40 +00:00
2019-11-18 15:06:20 +00:00
```
Usage: geodb [-i path] [-uh]
Manage local Opencaching database.
-i folder initialize database from dump located in given folder
-u update database with changelogs grabbed via OKAPI
-h display this help screen
```
2019-11-04 20:14:40 +00:00
2021-04-20 14:35:18 +00:00
## geofriends
Another tools is `geofriends`. It generates stats for a pair of users regarding their common caching activities.
```
Usage: geofriends nick1 nick2
Generate HTML stats for user caching intersection from Opencaching data.
```
2021-04-20 14:37:15 +00:00
## geolist
Another tools is `geolist`. It generates HTML list of caches from a list of cache codes.
```
Usage: geolist list_of_caches
Produce a HTML list of caches given their OC codes.
```
2021-04-20 14:35:18 +00:00
# Installation
2019-09-08 16:42:10 +00:00
To compile it requires:
2021-04-20 14:41:56 +00:00
* C++ compliler supporting C++17 and a minor subset of C++20 (gcc >=9 or clang =>8 should be enough).
2019-09-08 16:42:10 +00:00
* meson (at least 0.47.0) + ninja build system
2019-09-09 10:34:18 +00:00
* libcurl: https://curl.haxx.se/libcurl/
2019-09-08 16:42:10 +00:00
* JSON for Modern C++: https://github.com/nlohmann/json
* gpxlib: http://irdvo.nl/gpxlib/
2019-09-09 10:34:18 +00:00
* heatmap: https://github.com/lucasb-eyer/heatmap
2019-09-08 16:42:10 +00:00
* ImageMagick or GraphicsMagick Magick++ library
2019-09-09 10:34:18 +00:00
To build the project copy `config_user_example.h` to `config_user.h` and fill it out (at least API key is needed). Then
2021-04-20 14:41:56 +00:00
run
```
meson build
cd build
ninja
ninja install
```
You might need to set `CXX` variable to point to a correct compiler.
2019-09-08 16:42:10 +00:00
2021-04-20 14:35:18 +00:00
# Credits
2019-09-08 16:42:10 +00:00
2019-11-18 15:06:20 +00:00
* Maps of Poland `Poland.png` and `Poland_big.png` come from https://pl.wikipedia.org/wiki/Plik:Poland_location_map.svg and are licensed under CC-BY-SA and GNU FDL.
2019-09-24 12:56:44 +00:00
2019-11-18 15:06:20 +00:00
* Map of Poland `Poland_relief.png` comes from https://commons.wikimedia.org/wiki/File:Relief_Map_of_Poland.svg and is licensed under CC-BY-SA.
2019-09-24 12:56:44 +00:00
2020-04-01 00:47:14 +00:00
* Map of Poland `Poland_powiaty.png` comes from https://en.wikipedia.org/wiki/File:POLSKA_powiaty.svg and is licensed under CC-BY-SA.
2020-01-28 01:46:30 +00:00
* Map of France `Benelux.png` comes from https://pl.wikipedia.org/wiki/Plik:Benelux_location_map.svg and is licensed under CC-BY-SA.
* Map of France `France.png` comes from https://commons.wikimedia.org/wiki/File:France_location_map.svg and is licensed under CC-BY-SA and GNU FDL.
* Map of Germany `Germany.png` comes from https://commons.wikimedia.org/wiki/File:Germany_location_map.svg and is licensed under CC-BY-SA and GNU FDL.
* Map of Romania `Romania.png` comes from https://en.wikipedia.org/wiki/File:Romania_location_map.svg and is licensed under CC-BY-SA and GNU FDL.
* Map of UK `UK.png` comes from https://commons.wikimedia.org/wiki/File:United_Kingdom_NUTS_location_map.svg and is licensed under CC-BY-SA.
* Map of USA `USA.png` comes from https://commons.wikimedia.org/wiki/File:USA_location_map.svg and is licensed under CC-BY-SA and GNU FDL.
2019-11-18 15:06:20 +00:00
* Map of Europe `Europe.png` comes from https://pl.wikipedia.org/wiki/Plik:Europe_location_map.svg and is licensed under PD.
2019-09-24 12:56:44 +00:00
2020-01-25 11:37:00 +00:00
* Map of the World `World.png` comes from https://commons.wikimedia.org/wiki/File:World_location_map.svg and is licensed under PD.
2019-11-18 15:06:20 +00:00
* Maps of Voivodeships of Poland come from https://commons.wikimedia.org/wiki/File:Podlaskie_Voivodeship_location_map.svg, https://commons.wikimedia.org/wiki/File:Pomeranian_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:Kuyavian-Pomeranian_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:Warmian-Masurian_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:Masovian_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:Lesser_Poland_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:Greater_Poland_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:Opole_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:Lower_Silesian_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:Silesian_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:Lublin_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:Subcarpathian_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:West_Pomeranian_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:%C5%9Awi%C4%99tokrzyskie_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:Lubusz_Voivodeship_location_map.svg, https://pl.wikipedia.org/wiki/Plik:%C5%81%C3%B3d%C5%BA_Voivodeship_location_map.svg and are licensed under CC-BY-SA.
2019-11-05 20:07:04 +00:00
* Data about administrative boundaries of Poland comes from OpenStreetMap via https://wambachers-osm.website/boundaries/.
* CSS tricks used to render histograms are based on https://css-tricks.com/making-charts-with-css.
2020-11-14 17:30:16 +00:00
* Website uses https://github.com/CaptainCodeman/gif-player to display gifs.