forked from makinacorpus/landez
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
109 lines (70 loc) · 2.47 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
*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
=======
* Mathieu Leplatre <[email protected]>
* Sergej Tatarincev
* Thanks to mbutil authors <https://github.com/mapbox/mbutil>
=======
LICENSE
=======
* Lesser GNU Public License