MCPcopy Create free account
hub / github.com/opengeos/leafmap / view_vector

Function view_vector

leafmap/__init__.py:54–108  ·  view source on GitHub ↗

Visualize a vector dataset on the map. Args: vector (Union[str, GeoDataFrame]): The file path or URL to the vector data, or a GeoDataFrame. zoom_to_layer (bool, optional): Flag to zoom to the added layer. Defaults to True. pickable (bool, optional): Flag to enable pickin

(
    vector,
    zoom_to_layer=True,
    pickable=True,
    color_column=None,
    color_scheme="Quantiles",
    color_map=None,
    color_k=5,
    color_args={},
    open_args={},
    map_args={},
    **kwargs,
)

Source from the content-addressed store, hash-verified

52
53
54def view_vector(
55 vector,
56 zoom_to_layer=True,
57 pickable=True,
58 color_column=None,
59 color_scheme="Quantiles",
60 color_map=None,
61 color_k=5,
62 color_args={},
63 open_args={},
64 map_args={},
65 **kwargs,
66):
67 """Visualize a vector dataset on the map.
68
69 Args:
70 vector (Union[str, GeoDataFrame]): The file path or URL to the vector data, or a GeoDataFrame.
71 zoom_to_layer (bool, optional): Flag to zoom to the added layer. Defaults to True.
72 pickable (bool, optional): Flag to enable picking on the added layer. Defaults to True.
73 color_column (Optional[str], optional): The column to be used for color encoding. Defaults to None.
74 color_map (Optional[Union[str, Dict]], optional): The color map to use for color encoding. It can be a string or a dictionary. Defaults to None.
75 color_scheme (Optional[str], optional): The color scheme to use for color encoding. Defaults to "Quantiles".
76 Name of a choropleth classification scheme (requires mapclassify).
77 A mapclassify.MapClassifier object will be used
78 under the hood. Supported are all schemes provided by mapclassify (e.g.
79 'BoxPlot', 'EqualInterval', 'FisherJenks', 'FisherJenksSampled',
80 'HeadTailBreaks', 'JenksCaspall', 'JenksCaspallForced',
81 'JenksCaspallSampled', 'MaxP', 'MaximumBreaks',
82 'NaturalBreaks', 'Quantiles', 'Percentiles', 'StdMean',
83 'UserDefined'). Arguments can be passed in classification_kwds.
84 color_k (Optional[int], optional): The number of classes to use for color encoding. Defaults to 5.
85 color_args (dict, optional): Additional keyword arguments that will be passed to assign_continuous_colors(). Defaults to {}.
86 open_args (dict, optional): Additional keyword arguments that will be passed to geopandas.read_file(). Defaults to {}.
87 map_args (dict, optional): Additional keyword arguments that will be passed to lonboard.Map. Defaults to {}.
88 **kwargs: Additional keyword arguments that will be passed to lonboard.Layer.from_geopandas()
89
90 Returns:
91 lonboard.Map: A lonboard Map object.
92 """
93 from .deckgl import Map
94
95 m = Map(**map_args)
96 m.add_vector(
97 vector,
98 zoom_to_layer,
99 pickable,
100 color_column,
101 color_scheme,
102 color_map,
103 color_k,
104 color_args,
105 open_args,
106 **kwargs,
107 )
108 return m
109
110
111def view_pmtiles(

Callers

nothing calls this directly

Calls 2

add_vectorMethod · 0.95
MapClass · 0.70

Tested by

no test coverage detected