def test_static_map_generator2(self): width = 500 height = 500 simple_config = { 'params': { 'epsg': 31370, 'filetype': 'png', 'width': width, 'height': height, 'bbox': [145000, 195000, 165000, 215000] }, 'layers': [{ 'type': 'text', 'text': 'This is a test', 'color': '#FF3366', 'borderwidth': 0, 'font_size': 24, 'text_color': '#FF3366', 'gravity': 'center' } ] } Generator.generate(simple_config)
def test_static_map_generator(self): file_path = os.path.join(self.tempdir.name, 'test.png') width = 500 height = 500 simple_config = { 'params': { 'filename': file_path, 'epsg': 31370, 'filetype': 'png', 'width': width, 'height': height, 'bbox': [145000, 195000, 165000, 215000] }, 'layers': [{ 'type': 'text', 'text': 'This is a test', 'color': '#FF3366', 'borderwidth': 0, 'font_size': 24, 'text_color': '#FF3366', 'gravity': 'center' }] } Generator.generate(simple_config) self.assertTrue(os.path.isfile(file_path)) image = Image(filename=file_path) self.assertEqual(image.width, width) self.assertEqual(image.height, height)
def test_static_map_generator(self): file_path = os.path.join(self.tempdir.name, 'test.png') width = 500 height = 500 simple_config = { 'params': { 'filename': file_path, 'epsg': 31370, 'filetype': 'png', 'width': width, 'height': height, 'bbox': [145000, 195000, 165000, 215000] }, 'layers': [{ 'type': 'text', 'text': 'This is a test', 'color': '#FF3366', 'borderwidth': 0, 'font_size': 24, 'text_color': '#FF3366', 'gravity': 'center' } ] } Generator.generate(simple_config) self.assertTrue(os.path.isfile(file_path)) image = Image(filename=file_path) self.assertEqual(image.width, width) self.assertEqual(image.height, height)
def test_all_types(self): file_path = os.path.join(self.tempdir.name, 'test.png') width = 500 height = 500 config_31370 = { 'params': { 'filename': file_path, 'epsg': 31370, 'filetype': 'png', 'width': width, 'height': height, 'bbox': [145000, 195000, 165000, 215000] }, 'layers': [{ 'type': 'text', 'text': 'This is a test', 'color': '#FF3366', 'borderwidth': 1, 'font_size': 24, 'text_color': '#FF3366', 'gravity': 'center' }, { 'type': 'legend' }, { 'type': 'logo', 'url': 'https://www.onroerenderfgoed.be/assets/img/logo-og.png', 'opacity': 0.5, 'imagewidth': 100, 'imageheight': 100, 'gravity': 'south_west', 'offset': '0,0' }, { 'type': 'wkt', 'wkt': 'POLYGON ((155000 215000, 160000 210000, 160000 215000, 155000 215000))', 'color': 'steelblue', 'opacity': 0.5 }, { 'type': 'wms', 'url': 'http://geo.api.agiv.be/geodiensten/raadpleegdiensten/GRB-basiskaart/wmsgr?', 'layers': 'GRB_BSK' } ] } Generator.generate(config_31370)
def test_all_types(self): file_path = os.path.join(self.tempdir.name, 'test.png') width = 500 height = 500 config_31370 = { 'params': { 'filename': file_path, 'epsg': 31370, 'filetype': 'png', 'width': width, 'height': height, 'bbox': [145000, 195000, 165000, 215000] }, 'layers': [{ 'type': 'text', 'text': 'This is a test', 'color': '#FF3366', 'borderwidth': 1, 'font_size': 24, 'text_color': '#FF3366', 'gravity': 'center' }, { 'type': 'legend' }, { 'type': 'logo', 'url': 'https://www.onroerenderfgoed.be/assets/img/logo-og.png', 'opacity': 0.5, 'imagewidth': 100, 'imageheight': 100, 'gravity': 'south_west', 'offset': '0,0' }, { 'type': 'wkt', 'wkt': 'POLYGON ((155000 215000, 160000 210000, 160000 215000, 155000 215000))', 'color': 'steelblue', 'opacity': 0.5 }, { 'type': 'wms', 'url': 'http://geo.api.agiv.be/geodiensten/raadpleegdiensten/GRB-basiskaart/wmsgr?', 'layers': 'GRB_BSK' }] } Generator.generate(config_31370)
def test_static_map_generator2(self): width = 500 height = 500 simple_config = { 'params': { 'epsg': 31370, 'filetype': 'png', 'width': width, 'height': height, 'bbox': [145000, 195000, 165000, 215000] }, 'layers': [{ 'type': 'text', 'text': 'This is a test', 'color': '#FF3366', 'borderwidth': 0, 'font_size': 24, 'text_color': '#FF3366', 'gravity': 'center' }] } Generator.generate(simple_config)
}, 'layers': [{ 'type': 'text', 'text': 'This is a test', 'font_size': 24, 'text_color': '#FF3366' }, { 'type': 'logo', 'url': 'https://www.onroerenderfgoed.be/assets/img/logo-og.png', 'opacity': 0.5, 'imagewidth': 100, 'imageheight': 100 }, { 'type': 'wkt', 'wkt': 'POLYGON ((4.5 50.2, 5 50.2, 5 50, 4.5 50.2))', 'color': 'steelblue', 'opacity': 0.5 }, { 'type': 'wms', 'url': 'https://geo.onroerenderfgoed.be/geoserver/wms?', 'layers': 'vioe_geoportaal:landschapsbeheersplannen', 'featureid': 'landschapsbeheersplannen.3816' }, { 'type': 'wms', 'url': 'http://geo.api.agiv.be/geodiensten/raadpleegdiensten/GRB-basiskaart/wmsgr?', 'layers': 'GRB_BSK' }] } Generator.generate(config_4326)
'url': 'https://www.onroerenderfgoed.be/assets/img/logo-og.png', 'opacity': 0.5, 'imagewidth': 100, 'imageheight': 100 }, { 'type': 'wkt', 'wkt': 'POLYGON ((155000 215000, 160000 210000, 160000 215000, 155000 215000))', 'color': 'steelblue', 'opacity': 0.5 }, { 'type': 'wms', 'url': 'https://geo.onroerenderfgoed.be/geoserver/wms?', 'layers': 'vioe_geoportaal:landschapsbeheersplannen', 'featureid': 'landschapsbeheersplannen.3816' }, { 'type': 'wms', 'url': 'http://geo.api.agiv.be/geodiensten/raadpleegdiensten/GRB-basiskaart/wmsgr?', 'layers': 'GRB_BSK' } ] } Generator.generate(config_31370)
'type': 'logo', 'url': 'https://www.onroerenderfgoed.be/assets/img/logo-og.png', 'opacity': 0.5, 'imagewidth': 100, 'imageheight': 100 }, { 'type': 'wkt', 'wkt': 'POLYGON ((4.5 50.2, 5 50.2, 5 50, 4.5 50.2))', 'color': 'steelblue', 'opacity': 0.5 }, { 'type': 'wms', 'url': 'https://geo.onroerenderfgoed.be/geoserver/wms?', 'layers': 'vioe_geoportaal:landschapsbeheersplannen', 'featureid': 'landschapsbeheersplannen.3816' }, { 'type': 'wms', 'url': 'http://geo.api.agiv.be/geodiensten/raadpleegdiensten/GRB-basiskaart/wmsgr?', 'layers': 'GRB_BSK' } ] } Generator.generate(config_4326)
'filetype': 'png', 'width': 500, 'height': 500, 'bbox': [4.95, 50.95, 5, 51] }, 'layers': [{ 'type': 'text', 'text': 'This is a test', 'font_size': 40, 'text_color': '#FF3366' }, { 'type': 'wkt', 'wkt': 'POLYGON ((4.99 50.99, 4.995 50.99, 4.995 50, 4.99 50.99))', 'color': 'steelblue', 'opacity': 0.5 }, { 'type': 'wms', 'url': 'http://geo.api.agiv.be/geodiensten/raadpleegdiensten/GRB-basiskaart/wmsgr?', 'layers': 'GRB_BSK' } ] } Generator.generate(config_simple)
from static_map_generator.generator import Generator config_simple = { 'params': { 'filename': 'simple.png', 'epsg': 4326, 'filetype': 'png', 'width': 500, 'height': 500, 'bbox': [4.95, 50.95, 5, 51] }, 'layers': [{ 'type': 'text', 'text': 'This is a test', 'font_size': 40, 'text_color': '#FF3366' }, { 'type': 'wkt', 'wkt': 'POLYGON ((4.99 50.99, 4.995 50.99, 4.995 50, 4.99 50.99))', 'color': 'steelblue', 'opacity': 0.5 }, { 'type': 'wms', 'url': 'http://geo.api.agiv.be/geodiensten/raadpleegdiensten/GRB-basiskaart/wmsgr?', 'layers': 'GRB_BSK' }] } Generator.generate(config_simple)