ArchMap

The ArchMap project creates a map of Arch Linux users all over the world.

About

ArchMap

archmap.py generates geojson and kml files which can be used to display a map of Arch Linux users, it does this by parsing data from the ArchWiki.

One rendering of the data is on a map over at mapbox.com - This is updated manually so it may be out of date.

Have a look at the ArchMap page on the ArchWiki for more information about this project.

The documentation is hosted by readthedocs.org .

Synopsis

By default, running ./archmap.py will output three files to /tmp, users.txt, output.geojson and output.kml, this can be overridden by either using the config file or by the command line switches.

The config file should be placed in /etc/archmap.conf, this can be overridden by using --config <path-to-config-file>

Use

Running ./archmap.py --help will display this help message:

archmap.py [-h] [-v] [--config FILE] [--users FILE] [--geojson FILE] [--kml FILE] [--csv FILE] [--geojsonio]

optional arguments:
-h, --help      show this help message and exit
-v, --verbose   Show info messages
--config FILE   Use an alternative configuration file instead of /etc/archmap.conf
--users FILE    Use FILE for a list of users instead of getting the list from the ArchWiki
--geojson FILE  Output the geojson to FILE, use 'no' to disable output
--kml FILE      Output the kml to FILE, use 'no' to disable output
--csv FILE      Output the csv to FILE, use 'no' to disable output
--geojsonio     Send the geojson to http://geojson.io for processing

License

Everything in the ArchMap repo is unicensed.

All of the files that this script can generate (users.txt, output.geojson, output.kml, and output.csv) will contain text from the ArchWiki which puts them under the GNU Free Documentation License 1.3 or later.

Unlicense

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org/>

Install

System Requirements

Python 3.4 - If your running Arch, this shouldn't be a problem!

  • geojson
  • simplekml

If you want to be able to send the geojson to geojson.io via a GitHub gist:

How-to

Packaging is currently being worked on...

Manual git install

This will make a directory ArchMap/ with a link to archmap.py in it. It uses git and pip to resolve the dependencies.

Download this script:

echo -e "==> Make and cd to ./ArchMap\n"
mkdir ArchMap && cd ArchMap

echo -e "\n\n==> Download the ArchMap repo from GitHub\n"
git clone https://github.com/maelstrom59/ArchMap.git ArchMap-git

echo -e "\n\n==> Download the geojsonio.py repo from GitHub so you can use --geojsonio\n"
git clone https://github.com/jwass/geojsonio.py.git geojsonio.py-git

echo -e "\n\n==> Install the required packages\n"
pip install -r ArchMap-git/requirements.txt

echo -e "\n\n==> Link the geojsonio module into the ArchMap-git directory\n"
cd ArchMap-git && ln -s ../geojsonio.py-git/geojsonio/geojsonio.py

echo -e "\n\n==> Make an easy link to archmap.py\n"
cd ../ && ln -s ArchMap-git/archmap.py

echo -e "\n\n==> Test by printing the help message\n"
./archmap.py --help

Use

In this section:

Basic usage

If you would just like to get up and running, have a look at:

Examples

Help

The --help flag will output a help message with all of the available options:

./archmap.py --help
Basic use

By default, running ./archmap.py will output three files to /tmp, users.txt, output.geojson and output.kml, this can be overridden by either using the config file or by the following command line switches.

Using the --verbose flag will print information on what the script is doing:

./archmap.py --verbose

You can specify the output location for the geojson, kml and csv:

./archmap.py --geojson /tmp/archmap.geojson --kml /tmp/archmap.kml --csv /tmp/archmap.csv
geojson.io

http://geojson.io is a website that allows you to visualise geojson on an OpenStreetMap map, it also has options for converting the geojson to a range of other formats.

Using the --geojsonio flag will send the geojson to the site via a GitHub gist.

./archmap.py --geojsonio
Logging

If the script is run on a system that uses systemd, it will log to it using the syslog identifier - "ArchMap".

You can review all logs generated by archmap.py by using:

journalctl SYSLOG_IDENTIFIER=ArchMap

Advanced usage

If you would like to use any of this code, have a look at:

Use the code

Logging
archmap.message(message, verbosity, systemd=False)[source]

This function takes a string in message. If verbosity >= 1 it will print out message. If systemd is not False (the system uses the systemd journal), it will log to it using message.

Getting and parsing user data
archmap.get_users(output_file, verbosity)[source]

This funtion parses users from the ArchWiki and writes it to output_file

If verbosity >= 1 it will print out the string passed to message().

archmap.parse_users(users_file, verbosity)[source]

This function parses the wiki text from users_file into it's components. It returns a list of lists, each sub_list has 4 elements: [latitude, longitude, name, comment]

If verbosity >= 1 it will print out the string passed to message().

Output generators
archmap.make_geojson(parsed_users, output_file, send_to_geojsonio, verbosity)[source]

This function reads the user data supplied by parsed_users, it then generates geojson output and writes it to output_file.

parsed_users should be a list of lists, each sub_list should have 4 elements: [latitude, longitude, name, comment]

If you set send_to_geojsonio to True it will send the raw geojson to geojson.io via a GitHub gist.

If verbosity >= 1 it will print out the string passed to message().

archmap.make_kml(parsed_users, output_file, verbosity)[source]

This function reads the user data supplied by parsed_users, it then generates kml output and writes it to output_file.

parsed_users should be a list of lists, each sub_list should have 4 elements: [latitude, longitude, name, comment]

If verbosity >= 1 it will print out the string passed to message().

archmap.make_csv(parsed_users, output_file, verbosity)[source]

This function reads the user data supplied by parsed_users, it then generates csv output and writes it to output_file.

parsed_users should be a list of lists, each sub_list should have 4 elements: [latitude, longitude, name, comment]

If verbosity >= 1 it will print out the string passed to message().

Contribute

In this section:

Roadmap

  • Work on packaging
  • Use GitHub pages to build a homepage

Contributing

Contributions are always welcome! Here are a few ways you could contribute:

  • Bug fixes
  • New features
  • Testing on different platforms
  • Documentation

Support: External links

Development

All of the following commands assume you are are starting in the root ArchMap directory.

System Requirements

In addition to the System Requirements for the install, the following packages are required:

  • To generate these docs:
    • sphinx
  • For packaging:
    • setuptools
    • wheel

Documentation

cd docs/
make html

Packaging

kyrias has worked on the Arch Linux packaging.

Python packaging is currently in the works, have a look at this issue if you can help in any way.

python setup.py bdist_wheel

Indices and tables