Skip to main content

Build a MBTiles file from a tiles server or a Mapnik stylesheet.

Project description

Landez manipulates tiles, builds MBTiles and arrange tiles together into single images.

Tiles can either be obtained from a remote tile service URL, from a local Mapnik stylesheet or from MBTiles files.

For building MBTiles, it uses mbutil from Mapbox https://github.com/mapbox/mbutil at the final stage. The land covered is specified using a list of bounding boxes and zoom levels.

INSTALL

Landez requires nothing but python remote mode (specifying a tiles URL), but requires mapnik if the tiles are drawn locally.

sudo aptitude install python-mapnik

And PIL to export arranged tiles into images.

sudo aptitude install python-imaging

USAGE

Building MBTiles files

Remote tiles

Using a remote tile service (Cloudmade by default):

import logging
from landez import MBTilesBuilder

logging.basicConfig(level=logging.DEBUG)

mb = MBTilesBuilder(remote=True, cache=False)
mb.add_coverage(bbox=(-180.0, -90.0, 180.0, 90.0),
                    zoomlevels=[0, 1])
mb.run()

Please respect Tile usage policies <http://wiki.openstreetmap.org/wiki/Tile_usage_policy>

Local rendering

Using mapnik to render tiles:

import logging
from landez import MBTilesBuilder

logging.basicConfig(level=logging.DEBUG)

mb = MBTilesBuilder(stylefile="yourstyle.xml", filepath="dest.mbtiles")
mb.add_coverage(bbox=(-180.0, -90.0, 180.0, 90.0),
                zoomlevels=[0, 1])
mb.run()

From an other MBTiles file

import logging
from landez import MBTilesBuilder

logging.basicConfig(level=logging.DEBUG)

mb = MBTilesBuilder(mbtiles_file="yourfile.mbtiles", filepath="dest.mbtiles")
mb.add_coverage(bbox=(-180.0, -90.0, 180.0, 90.0),
                zoomlevels=[0, 1])
mb.run()

Export Images

Specify tiles sources in the exact same way as for building MBTiles files.

import logging
from landez import ImageExporter

logging.basicConfig(level=logging.DEBUG)

ie = ImageExporter(mbtiles_file="yourfile.mbtiles")
ie.export_image(bbox=(-180.0, -90.0, 180.0, 90.0), zoomlevel=3, imagepath="image.png")

AUTHORS

LICENSE

  • Lesser GNU Public License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

landez-1.3.tar.gz (10.1 kB view details)

Uploaded Source

File details

Details for the file landez-1.3.tar.gz.

File metadata

  • Download URL: landez-1.3.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for landez-1.3.tar.gz
Algorithm Hash digest
SHA256 72c17a234dd662d1b5e23daab86729c3dfccc3694c153a75c78285687b8a30b5
MD5 1211ac51d36622263bd2a1d5a217a812
BLAKE2b-256 0927c993ef6eca5cde8b66fd713744daeb8aa49e54e54f67a1c08bfb762d18f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page