Giter Site home page Giter Site logo

cartopy-tor-relays's Introduction

Map Tor relays using Cartopy

Create a map showing the geographic location of the Tor relays

Setup

  1. Create a venv: python -m venv venv && source venv/bin/activate
  2. Install requirements: pip install -r requirements.txt

Get the data to create the map

You'll need two files:

  1. The Tor consensus you want to use. Download one at: https://metrics.torproject.org/collector/recent/relay-descriptors/consensuses/
  2. The GeoLite2 City file from MaxMind (not the CSV format). See their website to create an account and get the file: https://dev.maxmind.com/geoip/geolite2-free-geolocation-data

Run the program

The program takes two arguments: the filename of the consensus and the filename of the GeoLite2 mmdb file.

python map.py 2024-03-27-13-00-00-consensus GeoLite2-City.mmdb

Optional parameters

--eps 1.5: control the density of the clusters. The default is 1.5 and generally gives nice maps. The higher the value, the bigger the clusters.

--weight: if set, use the consensus weight instead of the count of relays for the size of the clusters.

python map.py 2024-03-27-13-00-00-consensus GeoLite2-City.mmdb --eps 1.5 --weight

Using OSM data (optional)

It is possible to use data from OpenStreetMap as background (instead of the default cartopy image).

Check the code and the TODO comment to enable that. If you use OSM data and Mapbox as suggested in the comment, please use attribute it properly.

The following attribution line is generally enough:

© Mapbox © OpenStreetMap Improve this map

Attribution

This attribution or a similar should be included when you use this script with MaxMind data.

This product includes GeoLite2 Data created by MaxMind, available from https://www.maxmind.com

Examples of maps

Default cartopy background

map with cartopy background

With a custom style from MapBox

map with osm data

cartopy-tor-relays's People

Contributors

jdejaegh avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.