Coder Social home page Coder Social logo

wallmapper's Introduction

Wallmapper

A simple Python script that helps you create high resolution wallpapers from Mapbox maps.

Although Mapbox has a static API, it imposes a limit of 1280x1280 pixels. This script downloads individual tiles and knit them together to reach bigger resolutions. That way, you can use these beautiful maps as the wallpaper image of your favorite smartphone and/or tablet.

Note: Printing maps is not covered by the Mapbox TOS. If you'd like to print your maps, ask for permission first.

Usage

Make sure you have a MapBox account, and you replace the examples tileset with a tileset in your Mapbox account.

Run the --help for an overview of the available options:

$ python wallmapper.py -h
usage: Wallmapper [-h] [--width WIDTH] [--height HEIGHT] [--latitude LATITUDE]
                  [--longitude LONGITUDE] [--zoom ZOOM] [--basemap BASEMAP]
                  [--output OUTPUT] [--stats STATS]

Create high resolution wallpapers from Mapbox maps.

optional arguments:
  -h, --help            show this help message and exit
  --width WIDTH         Wallpaper width (default: 2160)
  --height HEIGHT       Wallpaper height (default: 1920)
  --latitude LATITUDE   Latitude (default: 38.9101)
  --longitude LONGITUDE Longitude (default: -77.0485)
  --zoom ZOOM           Zoom level (default: 17)
  --basemap BASEMAP     Mapbox basemap (default: eleanor.mnyzxgvi)
  --output OUTPUT       Output filename (default: wallmapper.png)
  --stats STATS         Print some raw statistics (default: True)

They are all optional and we provide defaults for all of them.

By default, we generate wallpapers centered in Washington, DC using the amazing woodcut basemap from Eleanor Lutz.

Examples

See the Makefile and the images in the examples directories for some nice basemaps at different zoom levels.

woodcut

nightvision

space

Troubleshooting

The scripts requires PIL to be installed and visible in the Python PATH. You may need to do something like the following:

$ export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages

Credits

The awesome folks from Mapbox deserve all the credit for all the beautiful, open-data based, maps they produce.

License

See LICENSE.

wallmapper's People

Contributors

zugaldia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wallmapper's Issues

404 Not Found when Coordinate Changes Significantly

How is the global availability of tiles determined? My mental model was something like this: tiles are generated globally and then stored and cached or rendered on-demand. Is the 404 I'm seeing coming from tiles simply not being available as in not rendered / cached, or is this a bug in wallmapper?

See this example, with different coordinates:

daniel@x1c /t/wallmapper> python wallmapper.py --zoom 16 --basemap mapbox.dc-nightvision --width 2560 --height 1440 --latitude 52.500385 --longitude 13.419779
Generating wallpaper...
This zoom level has this many tiles in total 65536
The central tile is (35210, 21498)
This is the tile set we will assemble ([35205, 35206, 35207, 35208, 35209, 35210, 35211, 35212, 35213, 35214, 35215], [21495, 21496, 21497, 21498, 21499, 21500, 21501])
The total number of required tiles is 77
The raw width before cropping is 2816
The raw height before cropping is 1792
Error: HTTP Error 404: Not Found
daniel@x1c /t/wallmapper> python wallmapper.py --zoom 16 --basemap mapbox.dc-nightvision --width 2560 --height 1440
Generating wallpaper...
This zoom level has this many tiles in total 65536
The central tile is (18741, 25067)
This is the tile set we will assemble ([18736, 18737, 18738, 18739, 18740, 18741, 18742, 18743, 18744, 18745, 18746], [25064, 25065, 25066, 25067, 25068, 25069, 25070])
The total number of required tiles is 77
The raw width before cropping is 2816
The raw height before cropping is 1792
Done.

401 Unauthorized for Emerald Base Map

It seems like the API disallows some default map ids. Is this a server limitation, or simply how wallmapper accesses the map tiles?

Example:

daniel@x1c /t/wallmapper> python wallmapper.py --zoom 12 --basemap mapbox.emerald --width 2560 --height 1440 --latitude 52.500385 --longitude 13.419779
Generating wallpaper...
This zoom level has this many tiles in total 131072
The central tile is (70421, 42997)
This is the tile set we will assemble ([70416, 70417, 70418, 70419, 70420, 70421, 70422, 70423, 70424, 70425, 70426], [42994, 42995, 42996, 42997, 42998, 42999, 43000])
The total number of required tiles is 77
The raw width before cropping is 2816
The raw height before cropping is 1792
Error: HTTP Error 401: Unauthorized

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.