def test_basemap(dump): polygons = haz_files.ReadBNA(input_file, 'PolygonSet') gmap = map_canvas.MapCanvas((400, 800), polygons) gmap.draw_background() gmap.save_background(os.path.join(dump, 'background1.png')) assert True
def test_basemap_wide(dump_folder): polygons = haz_files.ReadBNA(input_file, 'PolygonSet') gmap = map_canvas.MapCanvas((800, 400), polygons) gmap.draw_background() gmap.save_background(os.path.join(dump_folder, 'background2.png')) assert True
def test_basemap_square3(dump): p1 = Polygon([[0, 45], [1, 45], [1, 46], [0, 46]], metadata=('name' , 'land', '1')) poly_set = PolygonSet() poly_set.append(p1) gmap = map_canvas.MapCanvas((300, 100), land_polygons=poly_set) gmap.draw_background() gmap.save_background(os.path.join(dump, 'background_square3.png')) assert True
def test_draw_raster_map(dump): """ tests drawing the raster map """ import gnome polygons = haz_files.ReadBNA(input_file, 'PolygonSet') gmap = map_canvas.MapCanvas((1000, 1000), polygons) gmap.viewport = ((-127.47,48.10),(-127.22, 48.24)) gmap.draw_background() # make a raster map out of the BNA: raster_map = gnome.map.MapFromBNA(input_file, raster_size=10000) gmap.draw_raster_map(raster_map, outline=True) gmap.save_background(os.path.join(dump, 'raster.png'))
def plot_LEs(positions, filename='le_plot.png'): """ plot the LEs and save as an image """ # compute the bounding box: bb = BBox.fromPoints(positions) # bb.scale(1.1) canvas = map_canvas.MapCanvas( (500, 500), viewport=bb, preset_colors='web', background_color='white', ) canvas.draw_points(positions, diameter=1, color='black', shape="round", background=False) canvas.save("test.png")