Coverage Report

Created: 2025-12-31 08:30

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/frmts/wms/minidriver_tileservice.cpp
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  WMS Client Driver
4
 * Purpose:  Implementation of Dataset and RasterBand classes for WMS
5
 *           and other similar services.
6
 * Author:   Adam Nowacki, nowak@xpam.de
7
 *
8
 ******************************************************************************
9
 * Copyright (c) 2007, Adam Nowacki
10
 *
11
 * SPDX-License-Identifier: MIT
12
 ****************************************************************************/
13
14
#include "wmsdriver.h"
15
#include "minidriver_tileservice.h"
16
17
WMSMiniDriver_TileService::WMSMiniDriver_TileService()
18
0
{
19
0
}
20
21
WMSMiniDriver_TileService::~WMSMiniDriver_TileService()
22
0
{
23
0
}
24
25
CPLErr WMSMiniDriver_TileService::Initialize(CPLXMLNode *config,
26
                                             CPL_UNUSED char **papszOpenOptions)
27
0
{
28
0
    CPLErr ret = CE_None;
29
30
    // Try both spellings
31
0
    m_base_url = CPLGetXMLValue(config, "ServerURL",
32
0
                                CPLGetXMLValue(config, "ServerUrl", ""));
33
34
0
    if (m_base_url.empty())
35
0
    {
36
0
        CPLError(CE_Failure, CPLE_AppDefined,
37
0
                 "GDALWMS, TileService mini-driver: ServerURL missing.");
38
0
        ret = CE_Failure;
39
0
    }
40
0
    else
41
0
    {  // Prepare the url, leave it ready for extra arguments
42
0
        URLPrepare(m_base_url);
43
0
        const char *dataset = CPLGetXMLValue(config, "Dataset", "");
44
0
        const char *version = CPLGetXMLValue(config, "Version", "1");
45
0
        m_base_url += CPLOPrintf("interface=map&version=%s&dataset=%s&",
46
0
                                 version, dataset);
47
0
    }
48
49
0
    return ret;
50
0
}
51
52
CPLErr WMSMiniDriver_TileService::TiledImageRequest(
53
    WMSHTTPRequest &request, CPL_UNUSED const GDALWMSImageRequestInfo &iri,
54
    const GDALWMSTiledImageRequestInfo &tiri)
55
0
{
56
    // http://s0.tileservice.worldwindcentral.com/getTile?interface=map&version=1&dataset=bmng.topo.bathy.200401&level=5&x=18&y=6
57
0
    CPLString &url = request.URL;
58
0
    url = m_base_url;
59
0
    url += CPLOPrintf("level=%d&x=%d&y=%d", tiri.m_level, tiri.m_x, tiri.m_y);
60
0
    return CE_None;
61
0
}