Skip to content

Rednaxelus/flag-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

Flag-Map

A Python script that creates a map made of (emoji-)flags for the countries in the desired region.

Requirements

  • The images for the flags you want to use must be in PNG-format, and inside a folder called "flags" in the same directory as the script. (Unless you give the script a different folder for the argument "folder_name")
  • The name for the flag-images have the format: Unicode1 + "-" + Unicode2 Example: "1F1E6-1F1FA.png" for Australia. Regional indicator symbol, Enclosed Alphanumeric Supplement
  • countries.geojson needs to be in the same directory as the script. This is the offline geometric dataset used to determine what country a given geolocation belongs to.

How to run

Execute the function "do_it()" inside "main.py" through the Python interpreter. You can give these additional arguments:

latitude_start: float
longitude_start: float
latitude_div: float
longitude_div: float
step_lat: float; the smaller it is the more precise but larger the map gets. A good range is  0.1 to 1.0
background_color: RGBA
save: bool; if the created map should be saved automatically. Will never overwrite a file but instead tries to save under a new filename up to the number 99.
folder_name: the name of the folder where you have your flag-images stored

How it works

  1. The script checks the country(-code) that is present at a given geolocation (latitude, longitude). It does this for a given region defined by its starting geolocation, the number of steps, and the step-size.
  2. It loads the images of the flag for the given countrycode.
  3. It prints those images on a base image and exports it.

References

Notes

  • Open for feedback. I am a Python amateur and don't know the coding conventions that well yet.
  • The reason I don't use an online API is because it was too slow and I didn't want to spam thousands of requests each run. https://github.com/thampiman/reverse-geocoder worked amazingly fast, but I couldn't filter out the water-locations that well.

Releases

No releases published

Packages

No packages published

Languages