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

Commit c81972e

Browse files
Merge pull request #113 from umap-project/tms
Add TileLayer.tms
2 parents b2c906d + ca5f541 commit c81972e

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11 on 2017-04-26 12:58
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('leaflet_storage', '0003_auto_20160910_0624'),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name='tilelayer',
17+
name='tms',
18+
field=models.BooleanField(default=False),
19+
),
20+
]

leaflet_storage/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ class TileLayer(NamedModel):
7373
null=True,
7474
help_text=_('Order of the tilelayers in the edit box')
7575
)
76+
# See https://wiki.openstreetmap.org/wiki/TMS#The_Y_coordinate
77+
tms = models.BooleanField(default=False)
7678

7779
@property
7880
def json(self):

tests/test_tilelayer.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import pytest
2+
3+
from .base import TileLayerFactory
4+
5+
pytestmark = pytest.mark.django_db
6+
7+
8+
def test_tilelayer_json():
9+
tilelayer = TileLayerFactory(attribution='Attribution', maxZoom=19,
10+
minZoom=0, name='Name', rank=1, tms=True,
11+
url_template='http://{s}.x.fr/{z}/{x}/{y}')
12+
assert tilelayer.json == {
13+
'attribution': 'Attribution',
14+
'id': tilelayer.id,
15+
'maxZoom': 19,
16+
'minZoom': 0,
17+
'name': 'Name',
18+
'rank': 1,
19+
'tms': True,
20+
'url_template': 'http://{s}.x.fr/{z}/{x}/{y}'
21+
}

0 commit comments

Comments
 (0)