Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
Merge pull request #113 from umap-project/tms
Browse files Browse the repository at this point in the history
Add TileLayer.tms
  • Loading branch information
yohanboniface committed May 10, 2017
2 parents b2c906d + ca5f541 commit c81972e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
20 changes: 20 additions & 0 deletions leaflet_storage/migrations/0004_tilelayer_tms.py
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-26 12:58
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('leaflet_storage', '0003_auto_20160910_0624'),
]

operations = [
migrations.AddField(
model_name='tilelayer',
name='tms',
field=models.BooleanField(default=False),
),
]
2 changes: 2 additions & 0 deletions leaflet_storage/models.py
Expand Up @@ -73,6 +73,8 @@ class TileLayer(NamedModel):
null=True,
help_text=_('Order of the tilelayers in the edit box')
)
# See https://wiki.openstreetmap.org/wiki/TMS#The_Y_coordinate
tms = models.BooleanField(default=False)

@property
def json(self):
Expand Down
21 changes: 21 additions & 0 deletions tests/test_tilelayer.py
@@ -0,0 +1,21 @@
import pytest

from .base import TileLayerFactory

pytestmark = pytest.mark.django_db


def test_tilelayer_json():
tilelayer = TileLayerFactory(attribution='Attribution', maxZoom=19,
minZoom=0, name='Name', rank=1, tms=True,
url_template='http://{s}.x.fr/{z}/{x}/{y}')
assert tilelayer.json == {
'attribution': 'Attribution',
'id': tilelayer.id,
'maxZoom': 19,
'minZoom': 0,
'name': 'Name',
'rank': 1,
'tms': True,
'url_template': 'http://{s}.x.fr/{z}/{x}/{y}'
}

0 comments on commit c81972e

Please sign in to comment.