Skip to main content
=============================
Django TileStache
=============================

.. image:: https://badge.fury.io/py/django-tilestache.svg
:target: https://badge.fury.io/py/django-tilestache

.. image:: https://travis-ci.org/george-silva/django-tilestache.svg?branch=master
:target: https://travis-ci.org/george-silva/django-tilestache

.. image:: https://codecov.io/gh/george-silva/django-tilestache/branch/master/graph/badge.svg
:target: https://codecov.io/gh/george-silva/django-tilestache

Command and Control Center for Tilestache, inside a django app.

TileStache is a marvelous piece of software that can serve all kinds
of map tiles.

Our difficulty is that we needed a dynamic configuration for it, so we
created something integrated with Django, to act as command and control
center for it.

Basically the goal of this project is to have a Django app that can
configure TileStache. After that, we can serve some tiles from Django,
using the same configuration or use an array of TileStache servers to
it for us.

There are two main parts here:

* The configuration edition/storage/serialization;
* The command and control center;

Documentation
-------------

TODO

Quickstart
----------

Install Django TileStache::

pip install django-tilestache

Add it to your `INSTALLED_APPS`:

.. code-block:: python

INSTALLED_APPS = (
...
'django_tilestache.apps.DjangoTilestacheConfig',
...
)

Add Django TileStache's URL patterns:

.. code-block:: python

from django_tilestache import urls as django_tilestache_urls


urlpatterns = [
...
url(r'^', include(django_tilestache_urls)),
...
]

This is optional. We have a few views that you can configure yourself. You don't need to follow our URL scheme.

Usage
-----

Layers
======

It's simple:

.. code-block:: python

from django_tilestache.models import Layer

layer = Layer.objects.create(
**{
'name': 'foolayer' # this is the tilestache layer name
'provider': {

}, # tilestache provider options
'...' : 'foo' # all other options
}
)

Caches
======

TODO

Views
=====

There are two main views for django-tilestache. One is for serving the configuration and the other is for
serving tiles.

These views are not secured. It's your responsibility to configure these DRF APIViews with the
authentication and authorizations.

The configuration view will output a valid Tilestache JSON configuration.

The tile view will output a tile, depending on the registered configuration (caches and layers).

Cache management
================

You can use the CacheManager object to manage the cache
for your tilestache.

All you need to do is pass along the correct configuration
for it and use the methods, passing along geometries.

The CacheManager will take care of it. As long as your conf
is correct, it should do the correct thing.

How to run a tilestache server with the custom config?
======================================================

You can only use WSGI for now to do it.

Using gunicorn, here is a simple example:

.. code-block:: bash

gunicorn "django_tilestache:RemoteTileStache('http://localhost:8000/api/tilestache/')" -b localhost:8080 --log-level=DEBUG

You can pass along other options as well, such as authentication
information. **Dont forget to secure your configuration view!**

Features
--------

* Cache management (seed and purge)
* Store tilestache layers in django models
* Custom tilestache server that looksup for configuration in a remote server
* Endpoint for serving the tilestache configuration
* Endpoint for serving the tilestache tiles, from Django

Roadmap
-------

* Management commands (generate conf, purge/seed cache, etc);
* Allow to use the Django cache settings instead of defining your own again
* Allow simple definition of layers using a Django style declarative configuration, like so:

.. code-block:: python

class FooModel(models.Model):
name = models.CharField(max_length=128)
geom = models.PointField()
class Meta:
tilestache = (
{'name': 'foo-layer-a', 'provider': 'foo'},
{'name': 'foo-layer-b', 'provider': 'bar'}
)


Uploading new distros
---------------------

.. code-block:: bash

bumpversion --current-version x.x.x minor
make release
git push origin master --tags


Running Tests
-------------

Does the code actually work?

.. code-block:: python

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

WARNING: not fully tested with tox YET.

It's tested and working for Django 1.11 and Python 2.7.

Credits
-------

Tools used in rendering this package:

* `SIGMA Geosistemas`_
* TileStache_
* Cookiecutter_
* `cookiecutter-djangopackage`_

.. _SIGMA Geosistemas: https://sigmageosistemas.com.br
.. _TileStache: http://tilestache.org
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage




History
-------

0.6.0 (2017-05-30)

* First **actual release** on PyPI.
* New TileStache server that can ping a configuration URL and
self configure.
* Layer model and all the serializers needed to make this work
using Django REST Framework
* REST View to handle fecthing the configuration from the database
* REST View to serve tiles from Django

0.1.0 (2017-04-24)
++++++++++++++++++

* First release on PyPI.


Metadata

Release files for django-tilestache 2.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-tilestache 2.0.9
File Size Uploaded
django-tilestache-2.0.9.tar.gz 18.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-tilestache 2.0.9
File Interpreter ABI Platform
django_tilestache-2.0.9-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 39.8 kB

Release files / django-tilestache-2.0.9.tar.gz

Download URL django-tilestache-2.0.9.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
59107b02afd49bdd650c48d72fa03a36e15be7486ced0ffc278088b276214f09
BLAKE2b-256 checksum
How to use checksums
f8a781c8fb276fe9ba3d9996d2126592e1d98f099c1d8a7d568b2d95aa6761ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15

Release files / django_tilestache-2.0.9-py2.py3-none-any.whl

Download URL django_tilestache-2.0.9-py2.py3-none-any.whl
Size 21.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2720923dff6ddf4c38c544c363230284d7ce257376ee004f9955ca7ca598ebd9
BLAKE2b-256 checksum
How to use checksums
e4fb9151e9f1c23b1a2eda67c5511ee1ad98a90191c0f84a49c167c2fcd6e34e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15

Release history Release notifications | RSS feed

This release

2.0.9 This release

2 release files

2.0.8

2 release files

2.0.7

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.0

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page