Skip to content

Commit

Permalink
Package gdal2mbtiles
Browse files Browse the repository at this point in the history
  • Loading branch information
sfllaw committed Dec 14, 2012
1 parent ca6cd0b commit ebf5507
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .hgignore
@@ -1,3 +1,6 @@
syntax: glob

*.py[co]

build/
dist/
4 changes: 4 additions & 0 deletions MANIFEST.in
@@ -0,0 +1,4 @@
include LICENSE
include NOTICE

include test.py
84 changes: 84 additions & 0 deletions README.rst
@@ -0,0 +1,84 @@
======================================================
Convert GDAL-readable datasets into an MBTiles file.
======================================================

**gdal2mbtiles** helps you generate web mapping tiles that can be shown
through a browser-based mapping library on your website.

`GDAL-readable files`_ are images that are georeference, that means that
they are positioned and projected on to the world. In order to display a
dynamic map on the web, you don't want to serve the whole image at once,
so it must be sliced into tiles that are hosted by a tile server.

The MBTiles_ file format was developed by MapBox_ to make tile storage
easier. You can upload the final file to their service, or run your own
tile server. MapBox provides one called TileStream_.


Installation
============

You can get a copy of the source by using::

$ git clone https://github.com/ecometrica/gdal2mbtiles.git

Note that this program requires Python 2.7 or higher.


External Dependencies
---------------------

We rely on GDAL_ to read georeferenced datasets. However, it is not
available on PyPi.

Under Debian or Ubuntu, run the following to install it::

$ sudo apt-get install python-gdal


We also rely on VIPS_ to do fast image processing. It's also not
available on PyPi.

Under Debian or Ubuntu, run the following to install it::

$ sudo apt-get install python-vipscc

If you are using a virtualenv, you will need to symlink Python library
in the right place. Under Debian or Ubuntu, assuming Python 2.7, run the
following::

$ ln -s /usr/lib/python2.7/dist-packages/vipsCC $VIRTUAL_ENV/lib/python2.7/site-packages/


You'll also need a few other libraries to deal with large TIFF files and
to optimize the resulting PNG tiles.

Under Debian or Ubuntu, run the following to install them::

$ sudo apt-get install libtiff5 optipng pngquant


Reporting bugs and submitting patches
=====================================

Please check our `issue tracker`_ for known bugs and feature requests.

We accept pull requests for fixes and new features.


Credits
=======

Maxime Dupuis and Simon Law wrote this program, with the generous
support of Ecometrica_.

.. _GDAL-readable files: http://www.gdal.org/formats_list.html
.. _MBTiles: http://mapbox.com/developers/mbtiles/
.. _MapBox: http://mapbox.com/
.. _TileStream: https://github.com/mapbox/tilestream

.. _GDAL: http://www.gdal.org/
.. _VIPS: http://www.vips.ecs.soton.ac.uk/

.. _issue tracker: https://github.com/ecometrica/gdal2mbtiles/issues
.. _Ecometrica: http://ecometrica.com/
2 changes: 2 additions & 0 deletions gdal2mbtiles/__init__.py
Expand Up @@ -19,3 +19,5 @@

from __future__ import (absolute_import, division, print_function,
unicode_literals)

__version__ = '1.0.0'
4 changes: 3 additions & 1 deletion gdal2mbtiles/main.py
Expand Up @@ -212,7 +212,9 @@ def input_output(inputfile, outputfile):
f.close()


def main(args, configure_logging=None):
def main(args=None, configure_logging=None):
if args is None:
args = sys.argv[1:]
args = parse_args(args=args)

if configure_logging is not None:
Expand Down
45 changes: 45 additions & 0 deletions setup.py
@@ -0,0 +1,45 @@
#!/usr/bin/env python

from setuptools import setup

import gdal2mbtiles


setup(
name='gdal2mbtiles',
version=gdal2mbtiles.__version__,
description='Converts a GDAL-readable dataset into an MBTiles file. This is used to generate web maps.',
long_description=open('README.rst').read(),
license='Apache Software License, version 2.0',

author='Ecometrica',
author_email='admin@ecometrica.com',
url='https://github.com/ecometrica/gdal2mbtiles',

packages=['gdal2mbtiles'],
include_package_data=True,
install_requires=['numexpr', 'webcolors'],
# You also need certain dependencies that aren't in PyPi:
# python-gdal, python-vipscc, libtiff5, optipng, pngquant

entry_points={
'console_scripts': [
'gdal2mbtiles = gdal2mbtiles.main:main',
]
},


classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Other Audience',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX',
'Programming Language :: Python :: 2.7',
'Topic :: Multimedia :: Graphics :: Graphics Conversion',
'Topic :: Scientific/Engineering :: GIS',
],

zip_safe=True,
)

0 comments on commit ebf5507

Please sign in to comment.