Serve maps from MBTiles files
django-mbtiles serves maps from MBTiles files using Django.
It mainly relies on landez <https://github.com/makinacorpus/landez/>
_.
Checkout LiveMbtiles <https://github.com/makinacorpus/django-mbtiles/tree/livembtiles>
_ a simple maps catalog project that takes advantage of django-mbtiles.
Last stable version:
::
pip install django-mbtiles
Last development version:
::
pip install -e git+https://github.com/makinacorpus/django-mbtiles.git#egg=django-mbtiles
Add mbtilesmap
to your INSTALLED_APPS
Make sure you have 'django.core.context_processors.static'
in your context processors <https://docs.djangoproject.com/en/dev/howto/static-files/#with-a-context-processor>
_
Include mbtilesmap urls into your project
::
urlpatterns = patterns('',
...
...
url(r'^', include('mbtilesmap.urls', namespace='mb', app_name='mbtilesmap')),
)
::
{% load mbtilesmap_tags %}
...
{% block head %}
{% mbtilesmap_head %}
{{ block.super }}
{% endblock head %}
...
...
{% mbtilesmap filename %}
MBTiles files can be loaded from subfolders with MBTILES_ROOT
setting.
::
{% mbtilesmap filename catalog="subfolder" %}
You can find a working demo project (MBTiles maps browser livembtiles)
in the example/
folder of the source tree (see dedicated README.rst
file).
http
section :::
http {
...
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=master:10m inactive=7d max_size=1g;
proxy_temp_path /var/tmp/nginx;
}
Cache name will be master
, index will be 10m
, will last 7d
and have a maximum size of 1g
.
::
location @proxy {
...
proxy_cache master;
proxy_cache_key $$scheme$$host$$uri$$is_args$$args;
proxy_cache_valid 200 7d;
proxy_cache_use_stale error timeout invalid_header;
}
See example project's buildout for deployment automation.
* Mathieu Leplatre <[email protected]>
* `Andreas Trawoeger <https://github.com/atrawog>`_
|makinacom|_
.. |makinacom| image:: http://depot.makina-corpus.org/public/logo.gif .. _makinacom: http://www.makina-corpus.com
* Lesser GNU Public License