Skip to content

Surveymap

Create map of snailz survey points based on generated data.

surveymap(options)

Main driver for snailz map creation.

  • options.samples: path to samples CSV file.
  • options.outfile: optional path to saved output file.

Parameters:

Name Type Description Default
options Namespace

see list above.

required

Returns:

Type Description
None

Either writes the generated map to a file or displays it in the browser.

Source code in snailz/surveymap.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
def surveymap(options: Namespace) -> None:
    '''Main driver for snailz map creation.

    -   options.samples: path to samples CSV file.
    -   options.outfile: optional path to saved output file.

    Args:
        options: see list above.

    Returns:
        Either writes the generated map to a file or displays it in the browser.
    '''
    samples = pl.read_csv(options.samples)['survey_id', 'lon', 'lat']
    fig = go.Figure(go.Scattermapbox(
        lon=samples['lon'],
        lat=samples['lat'],
        marker=go.scattermapbox.Marker(color=samples['survey_id']),
    ))
    fig.update_layout(
        mapbox={
            'style': 'open-street-map',
            'center': {'lon': -124.2, 'lat': 48.85},
            'zoom': 11,
        },
        margin={'l': 0, 'r': 0, 'b': 0, 't': 0},
    )
    if options.outfile:
        fig.write_image(options.outfile)
    else:
        fig.show()