Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here


Procedurally generate pirate treasure maps.

Subscribe to updates I use PirateMap

Statistics on PirateMap

Number of watchers on Github 143
Number of open issues 4
Main language Python
Average time to merge a PR about 5 hours
Open pull requests 3+
Closed pull requests 1+
Last commit over 3 years ago
Repo Created almost 5 years ago
Repo Last Updated over 2 years ago
Size 14 KB
Organization / Authorfogleman
Page Updated
Do you use PirateMap? Leave a review!
View open issues (4)
View PirateMap activity
View on github
Book a Mock Interview With Me (Silicon Valley Engineering Leader, 100s of interviews conducted)
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating PirateMap for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Pirate Maps

Procedurally generated pirate treasure maps. X marks the spot!



I used several excellent third party libraries...

  • cairo for rendering
  • colour for color interpolation
  • noise for simplex noise
  • Pillow for saving debug images of noise layers
  • pyhull for delaunay triangulation
  • Shapely for all kinds of 2D geometry operations

How to Run

The script will generate several random maps and save them as PNG files.

git clone https://github.com/fogleman/PirateMap.git
cd PirateMap
pip install -r requirements.txt
python main.py

How it Works

It took me a while to decide on an approach for generating the land masses. I didn't want to just generate some simplex noise, threshold it and render it. I wanted to actually compute a polygonal shape that I could do further operations on. So here's how that works...

  • generate a layer of simplex noise with several octaves, with decreasing values as the edge of the image is approached
  • fill the screen with randomly positioned points evenly spaced using the poisson disc algorithm
  • filter the poisson points to those where the corresponding noise value is above some threshold
  • take these points and compute a concave hull or alpha shape with them

Shapely's buffer function is used heavily for padding or cleaning up shapes.

I also wrote an xkcdify function to add some perturbations to some of the polygons, namely the different water color gradations.

PirateMap open issues Ask a question     (View All Issues)
  • almost 5 years Cannot build on linux
PirateMap open pull requests (View All Pulls)
  • py2cairo installation instructions
  • Python3 support for great good
  • Adds python2 note in ReadMe.md as requested in #4
PirateMap list of languages used
Other projects in Python
Powered by Autocode - Instant Webhooks, Scripts and APIs
Autocode logo wordmark