Example #1
0
 def test_params(self):
     layout = WMSTileLayout(
         url='http://example.com/folder',
         layers='l1,l2',
         srs='EPSG:1000',
         format='image/png',
         tilegrid=self.tilegrid,
         params={
             'TRANSPARENT': 'FALSE',
             'PARAM': 'Value',
             'FILTER': 'l1:"field" = '
             '{PARAM}'
             ''
         },
     )
     result = urlparse(layout.filename(TileCoord(0, 0, 0)))
     assert result.netloc == 'example.com'
     assert result.path == '/folder'
     query = parse_qs(result.query)
     assert query['PARAM'] == ['Value']
     assert query['FILTER'] == ['l1:"field" = ' 'Value' '']
     assert query['LAYERS'] == ['l1,l2']
     assert query['FORMAT'] == ['image/png']
     assert query['TRANSPARENT'] == ['FALSE']
     assert query['SERVICE'] == ['WMS']
     assert query['VERSION'] == ['1.1.1']
     assert query['REQUEST'] == ['GetMap']
     assert query['SRS'] == ['EPSG:1000']
     assert query['WIDTH'] == ['100']
     assert query['HEIGHT'] == ['100']
     bbox = [float(i) for i in query['BBOX'][0].split(',')]
     assert bbox == [420000.0, 340000.0, 430000.0, 350000.0]
Example #2
0
 def test_png(self):
     layout = WMSTileLayout(url='http://example.com/folder',
                            layers='l1,l2',
                            srs='EPSG:1000',
                            format='image/png',
                            tilegrid=self.tilegrid)
     result = urlparse(layout.filename(TileCoord(0, 0, 0)))
     self.assertEqual(result.netloc, 'example.com')
     self.assertEqual(result.path, '/folder')
     query = parse_qs(result.query)
     self.assertEqual(query['LAYERS'], ['l1,l2'])
     self.assertEqual(query['FORMAT'], ['image/png'])
     self.assertEqual(query['TRANSPARENT'], ['TRUE'])
     self.assertEqual(query['SERVICE'], ['WMS'])
     self.assertEqual(query['VERSION'], ['1.1.1'])
     self.assertEqual(query['REQUEST'], ['GetMap'])
     self.assertEqual(query['SRS'], ['EPSG:1000'])
     self.assertEqual(query['WIDTH'], ['100'])
     self.assertEqual(query['HEIGHT'], ['100'])
     bbox = [float(i) for i in query['BBOX'][0].split(',')]
     self.assertEqual(len(bbox), 4)
     self.assertEqual(bbox[0], 420000.0)
     self.assertEqual(bbox[1], 340000.0)
     self.assertEqual(bbox[2], 430000.0)
     self.assertEqual(bbox[3], 350000.0)
Example #3
0
 def test_png(self):
     layout = WMSTileLayout(
         url='http://example.com/folder',
         layers='l1,l2',
         srs='EPSG:1000',
         format='image/png',
         tilegrid=self.tilegrid)
     result = urlparse(layout.filename(TileCoord(0, 0, 0)))
     self.assertEqual(result.netloc, 'example.com')
     self.assertEqual(result.path, '/folder')
     query = parse_qs(result.query)
     self.assertEqual(query['LAYERS'], ['l1,l2'])
     self.assertEqual(query['FORMAT'], ['image/png'])
     self.assertEqual(query['TRANSPARENT'], ['TRUE'])
     self.assertEqual(query['SERVICE'], ['WMS'])
     self.assertEqual(query['VERSION'], ['1.1.1'])
     self.assertEqual(query['REQUEST'], ['GetMap'])
     self.assertEqual(query['SRS'], ['EPSG:1000'])
     self.assertEqual(query['WIDTH'], ['100'])
     self.assertEqual(query['HEIGHT'], ['100'])
     bbox = [float(i) for i in query['BBOX'][0].split(',')]
     self.assertEqual(len(bbox), 4)
     self.assertEqual(bbox[0], 420000.0)
     self.assertEqual(bbox[1], 340000.0)
     self.assertEqual(bbox[2], 430000.0)
     self.assertEqual(bbox[3], 350000.0)
 def test_params(self):
     layout = WMSTileLayout(
         url="http://example.com/folder",
         layers="l1,l2",
         srs="EPSG:1000",
         format="image/png",
         tilegrid=self.tilegrid,
         params={
             "TRANSPARENT": "FALSE",
             "PARAM": "Value",
             "FILTER": 'l1:"field" = '
             "{PARAM}"
             ""
         },
     )
     result = urlparse(layout.filename(TileCoord(0, 0, 0)))
     assert result.netloc == "example.com"
     assert result.path == "/folder"
     query = parse_qs(result.query)
     assert query["PARAM"] == ["Value"]
     assert query["FILTER"] == ['l1:"field" = ' "Value" ""]
     assert query["LAYERS"] == ["l1,l2"]
     assert query["FORMAT"] == ["image/png"]
     assert query["TRANSPARENT"] == ["FALSE"]
     assert query["SERVICE"] == ["WMS"]
     assert query["VERSION"] == ["1.1.1"]
     assert query["REQUEST"] == ["GetMap"]
     assert query["SRS"] == ["EPSG:1000"]
     assert query["WIDTH"] == ["100"]
     assert query["HEIGHT"] == ["100"]
     bbox = [float(i) for i in query["BBOX"][0].split(",")]
     assert bbox == [420000.0, 340000.0, 430000.0, 350000.0]
 def test_border(self):
     layout = WMSTileLayout(
         url="http://example.com/folder",
         layers="l1,l2",
         srs="EPSG:1000",
         format="image/png",
         tilegrid=self.tilegrid,
         border=10,
     )
     result = urlparse(layout.filename(TileCoord(0, 0, 0)))
     assert result.netloc == "example.com"
     assert result.path == "/folder"
     query = parse_qs(result.query)
     assert query["LAYERS"] == ["l1,l2"]
     assert query["FORMAT"] == ["image/png"]
     assert query["TRANSPARENT"] == ["TRUE"]
     assert query["SERVICE"] == ["WMS"]
     assert query["VERSION"] == ["1.1.1"]
     assert query["REQUEST"] == ["GetMap"]
     assert query["SRS"] == ["EPSG:1000"]
     assert query["WIDTH"] == ["120"]
     assert query["HEIGHT"] == ["120"]
     bbox = [float(i) for i in query["BBOX"][0].split(",")]
     assert len(bbox) == 4
     assert bbox == [419000.0, 339000.0, 431000.0, 351000.0]
Example #6
0
 def test_params(self):
     layout = WMSTileLayout(
         url='http://example.com/folder',
         layers='l1,l2',
         srs='EPSG:1000',
         format='image/png',
         tilegrid=self.tilegrid,
         params={
             'TRANSPARENT': 'FALSE',
             'PARAM': 'Value',
             'FILTER': 'l1:"field" = ''{PARAM}'''
         },
     )
     result = urlparse(layout.filename(TileCoord(0, 0, 0)))
     assert result.netloc == 'example.com'
     assert result.path == '/folder'
     query = parse_qs(result.query)
     assert query['PARAM'] == ['Value']
     assert query['FILTER'] == ['l1:"field" = ''Value''']
     assert query['LAYERS'] == ['l1,l2']
     assert query['FORMAT'] == ['image/png']
     assert query['TRANSPARENT'] == ['FALSE']
     assert query['SERVICE'] == ['WMS']
     assert query['VERSION'] == ['1.1.1']
     assert query['REQUEST'] == ['GetMap']
     assert query['SRS'] == ['EPSG:1000']
     assert query['WIDTH'] == ['100']
     assert query['HEIGHT'] == ['100']
     bbox = [float(i) for i in query['BBOX'][0].split(',')]
     assert bbox == [420000.0, 340000.0, 430000.0, 350000.0]
Example #7
0
 def test_metatile(self):
     layout = WMSTileLayout(url='http://example.com/folder',
                            layers='l1,l2',
                            srs='EPSG:1000',
                            format='image/png',
                            tilegrid=self.tilegrid)
     result = urlparse(layout.filename(TileCoord(1, 0, 0, 2)))
     assert result.netloc == 'example.com'
     assert result.path == '/folder'
     query = parse_qs(result.query)
     assert query['LAYERS'] == ['l1,l2']
     assert query['FORMAT'] == ['image/png']
     assert query['TRANSPARENT'] == ['TRUE']
     assert query['SERVICE'] == ['WMS']
     assert query['VERSION'] == ['1.1.1']
     assert query['REQUEST'] == ['GetMap']
     assert query['SRS'] == ['EPSG:1000']
     assert query['WIDTH'] == ['200']
     assert query['HEIGHT'] == ['200']
     bbox = [float(i) for i in query['BBOX'][0].split(',')]
     assert bbox == [420000.0, 340000.0, 430000.0, 350000.0]
Example #8
0
 def test_metatile(self):
     layout = WMSTileLayout(
         url='http://example.com/folder',
         layers='l1,l2',
         srs='EPSG:1000',
         format='image/png',
         tilegrid=self.tilegrid)
     result = urlparse(layout.filename(TileCoord(1, 0, 0, 2)))
     assert result.netloc == 'example.com'
     assert result.path == '/folder'
     query = parse_qs(result.query)
     assert query['LAYERS'] == ['l1,l2']
     assert query['FORMAT'] == ['image/png']
     assert query['TRANSPARENT'] == ['TRUE']
     assert query['SERVICE'] == ['WMS']
     assert query['VERSION'] == ['1.1.1']
     assert query['REQUEST'] == ['GetMap']
     assert query['SRS'] == ['EPSG:1000']
     assert query['WIDTH'] == ['200']
     assert query['HEIGHT'] == ['200']
     bbox = [float(i) for i in query['BBOX'][0].split(',')]
     assert bbox == [420000.0, 340000.0, 430000.0, 350000.0]