pydeck module¶
Layer
¶
Bases: Layer
Configures a deck.gl layer for rendering on a map. Parameters passed here will be specific to the particular deck.gl layer that you are choosing to use. Please see the deck.gl Layer catalog (https://deck.gl/docs/api-reference/layers) to determine the particular parameters of your layer. You are highly encouraged to look at the examples in the pydeck documentation.
Source code in leafmap/deck.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
__init__(type, data=None, id=None, use_binary_transport=None, **kwargs)
¶
Initialize a Layer object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type
|
str
|
Type of layer to render, e.g., HexagonLayer. See deck.gl Layer catalog (https://deck.gl/docs/api-reference/layers) |
required |
data
|
str
|
Unique name for layer. Defaults to None. |
None
|
id
|
str | dict | DataFrame
|
Either a URL of data to load in or an array of data. Defaults to None. |
None
|
use_binary_transport
|
bool
|
Boolean indicating binary data. Defaults to None. |
None
|
Source code in leafmap/deck.py
80 81 82 83 84 85 86 87 88 89 |
|
Map
¶
Bases: Deck
The Map class inherits pydeck.Deck.
Returns:
Name | Type | Description |
---|---|---|
object |
pydeck.Deck object. |
Source code in leafmap/deck.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
|
__init__(center=(20, 0), zoom=1.2, **kwargs)
¶
Initialize a Map object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
center
|
tuple
|
Center of the map in the format of (lat, lon). Defaults to (20, 0). |
(20, 0)
|
zoom
|
int
|
The map zoom level. Defaults to 1.2. |
1.2
|
Source code in leafmap/deck.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
add_basemap(basemap='HYBRID')
¶
Adds a basemap to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
basemap
|
str
|
Can be one of string from pydeck_basemaps. Defaults to 'HYBRID'. |
'HYBRID'
|
Source code in leafmap/deck.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|
add_gdf(gdf, layer_type='GeoJsonLayer', layer_name=None, random_color_column=None, **kwargs)
¶
Adds a GeoPandas GeoDataFrame to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gdf
|
GeoDataFrame
|
The GeoPandas GeoDataFrame to add to the map. |
required |
layer_type
|
str
|
The layer type to be used. Defaults to "GeoJsonLayer". |
'GeoJsonLayer'
|
layer_name
|
str
|
The layer name to be used. Defaults to None. |
None
|
random_color_column
|
str
|
The column name to use for random color. Defaults to None. |
None
|
Raises:
Type | Description |
---|---|
TypeError
|
gdf must be a GeoPandas GeoDataFrame. |
Source code in leafmap/deck.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
|
add_geojson(filename, layer_name=None, random_color_column=None, **kwargs)
¶
Adds a GeoJSON file to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
The input file path to the vector dataset. |
required |
layer_name
|
str
|
The layer name to be used. Defaults to None. |
None
|
random_color_column
|
str
|
The column name to use for random color. Defaults to None. |
None
|
Raises:
Type | Description |
---|---|
FileNotFoundError
|
The provided vector file could not be found. |
Source code in leafmap/deck.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
|
add_kml(filename, layer_name=None, random_color_column=None, **kwargs)
¶
Adds a KML file to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
The input file path to the vector dataset. |
required |
layer_name
|
str
|
The layer name to be used. Defaults to None. |
None
|
random_color_column
|
str
|
The column name to use for random color. Defaults to None. |
None
|
Raises:
Type | Description |
---|---|
FileNotFoundError
|
The provided vector file could not be found. |
Source code in leafmap/deck.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
|
add_layer(layer, layer_name=None, **kwargs)
¶
Add a layer to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer
|
Layer
|
A pydeck Layer object. |
required |
Source code in leafmap/deck.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|
add_shp(filename, layer_name=None, random_color_column=None, **kwargs)
¶
Adds a shapefile to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
The input file path to the vector dataset. |
required |
layer_name
|
str
|
The layer name to be used. Defaults to None. |
None
|
random_color_column
|
str
|
The column name to use for random color. Defaults to None. |
None
|
Raises:
Type | Description |
---|---|
FileNotFoundError
|
The provided vector file could not be found. |
Source code in leafmap/deck.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
add_vector(data, layer_type='GeoJsonLayer', layer_name=None, random_color_column=None, **kwargs)
¶
Adds a vector file to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
str
|
The input file path to the vector dataset. |
required |
layer_type
|
str
|
The layer type to be used. Defaults to "GeoJsonLayer". |
'GeoJsonLayer'
|
layer_name
|
str
|
The layer name to be used. Defaults to None. |
None
|
random_color_column
|
str
|
The column name to use for random color. Defaults to None. |
None
|
Raises:
Type | Description |
---|---|
FileNotFoundError
|
The provided vector file could not be found. |
Source code in leafmap/deck.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
|