pyosv.plot.geo

 1import numpy as np
 2
 3def geo_plot(img : np.ndarray, metadata : dict, bounds : list) -> None:
 4    '''
 5        Overlay a satellite image on a map
 6
 7        Parameters:
 8        -----------
 9            - img : np.ndarray
10                the WxHxC image to be plotted, with W width, H height and B bands (channel last)
11            - metadata : dict
12                metadata for the image to be saved
13            - bounds : list
14                list of geo bounds for the image
15        
16        Returns:
17        --------
18        Nothing an image is displayed
19
20        Usage:
21        ------
22        ```python
23        import numpy as np
24
25        img         = np.array(  
26            [[
27                [0.1, 0.2, 0.3],  
28                [0.4, 0.5, 0.6],  
29                [0.7, 0.8, 0.9]
30             ],
31             [
32                [1.1, 1.2, 1.3],  
33                [1.4, 1.5, 1.6],  
34                [1.7, 1.8, 1.9]
35             ]
36            ]  
37        )  
38            
39        meta = {'driver': 'GTiff',  
40                'dtype': 'float64',  
41                'nodata': None,  
42                'width': 3,  
43                'height': 3,  
44                'count': 2,  
45                'crs': CRS.from_epsg(32632),  
46                'transform': Affine(10.0, 0.0, 638640.0, 0.0, -10.0, 5084590.0),  
47                'blockxsize': 3,  
48                'blockysize': 3,  
49                'tiled': True,  
50                'compress': 'lzw',  'interleave': 'pixel'  
51                }  
52
53        bounds = BoundingBox(left=638640.0, bottom=5074190.0, right=649070.0, top=5084590.0))  
54
55        geo_plot(img, meta, bounds)
56        ```
57
58        Output:
59        ------
60        Nothing, the image is displayed
61    '''
62    pass
def geo_plot(img: numpy.ndarray, metadata: dict, bounds: list) -> None:
 4def geo_plot(img : np.ndarray, metadata : dict, bounds : list) -> None:
 5    '''
 6        Overlay a satellite image on a map
 7
 8        Parameters:
 9        -----------
10            - img : np.ndarray
11                the WxHxC image to be plotted, with W width, H height and B bands (channel last)
12            - metadata : dict
13                metadata for the image to be saved
14            - bounds : list
15                list of geo bounds for the image
16        
17        Returns:
18        --------
19        Nothing an image is displayed
20
21        Usage:
22        ------
23        ```python
24        import numpy as np
25
26        img         = np.array(  
27            [[
28                [0.1, 0.2, 0.3],  
29                [0.4, 0.5, 0.6],  
30                [0.7, 0.8, 0.9]
31             ],
32             [
33                [1.1, 1.2, 1.3],  
34                [1.4, 1.5, 1.6],  
35                [1.7, 1.8, 1.9]
36             ]
37            ]  
38        )  
39            
40        meta = {'driver': 'GTiff',  
41                'dtype': 'float64',  
42                'nodata': None,  
43                'width': 3,  
44                'height': 3,  
45                'count': 2,  
46                'crs': CRS.from_epsg(32632),  
47                'transform': Affine(10.0, 0.0, 638640.0, 0.0, -10.0, 5084590.0),  
48                'blockxsize': 3,  
49                'blockysize': 3,  
50                'tiled': True,  
51                'compress': 'lzw',  'interleave': 'pixel'  
52                }  
53
54        bounds = BoundingBox(left=638640.0, bottom=5074190.0, right=649070.0, top=5084590.0))  
55
56        geo_plot(img, meta, bounds)
57        ```
58
59        Output:
60        ------
61        Nothing, the image is displayed
62    '''
63    pass

Overlay a satellite image on a map

Parameters:

- img : np.ndarray
    the WxHxC image to be plotted, with W width, H height and B bands (channel last)
- metadata : dict
    metadata for the image to be saved
- bounds : list
    list of geo bounds for the image

Returns:

Nothing an image is displayed

Usage:

import numpy as np

img         = np.array(  
    [[
        [0.1, 0.2, 0.3],  
        [0.4, 0.5, 0.6],  
        [0.7, 0.8, 0.9]
     ],
     [
        [1.1, 1.2, 1.3],  
        [1.4, 1.5, 1.6],  
        [1.7, 1.8, 1.9]
     ]
    ]  
)  

meta = {'driver': 'GTiff',  
        'dtype': 'float64',  
        'nodata': None,  
        'width': 3,  
        'height': 3,  
        'count': 2,  
        'crs': CRS.from_epsg(32632),  
        'transform': Affine(10.0, 0.0, 638640.0, 0.0, -10.0, 5084590.0),  
        'blockxsize': 3,  
        'blockysize': 3,  
        'tiled': True,  
        'compress': 'lzw',  'interleave': 'pixel'  
        }  

bounds = BoundingBox(left=638640.0, bottom=5074190.0, right=649070.0, top=5084590.0))  

geo_plot(img, meta, bounds)

Output:

Nothing, the image is displayed