File: test_tms.py

package info (click to toggle)
owslib 0.35.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,772 kB
  • sloc: xml: 143,288; python: 24,542; makefile: 15
file content (21 lines) | stat: -rw-r--r-- 698 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from tests.utils import scratch_file
from tests.utils import service_ok

import pytest

SERVICE_URL = 'http://geodata.nationaalgeoregister.nl/tiles/service/tms/1.0.0'


@pytest.mark.online
@pytest.mark.skipif(not service_ok(SERVICE_URL),
                    reason="TMS service is unreachable")
def test_tms():
    # Find out what a TMS has to offer. Service metadata:
    from owslib.tms import TileMapService
    tms = TileMapService(SERVICE_URL)

    # Fetch a tile (using some defaults):
    tile = tms.gettile(7, 7, 4, title='brtachtergrondkaart', srs='EPSG:28992', mimetype='image/png')
    out = open(scratch_file('brtachtergrondkaart.png'), 'wb')
    out.write(tile.read())
    out.close()