plotlymap module¶
Canvas
¶
The widgets.HBox containing the map and a toolbar.
Source code in leafmap/plotlymap.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
__init__(map, map_min_width='90%', map_max_width='98%', map_refresh=False, **kwargs)
¶
Initialize the Canvas.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
map
|
FigureWidget
|
The map to display. |
required |
map_min_width
|
str
|
The minimum width of the map. Defaults to '90%'. |
'90%'
|
map_max_width
|
str
|
The maximum width of the map. Defaults to '98%'. |
'98%'
|
map_refresh
|
bool
|
Whether to refresh the map when the map is resized. Defaults to False. |
False
|
Source code in leafmap/plotlymap.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
toolbar_reset()
¶
Reset the toolbar so that no tool is selected.
Source code in leafmap/plotlymap.py
67 68 69 70 71 72 |
|
Map
¶
Bases: FigureWidget
The Map class inherits the Plotly FigureWidget class. More info at https://plotly.com/python/figurewidget.
Source code in leafmap/plotlymap.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 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 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 |
|
__init__(center=(20, 0), zoom=1, basemap='open-street-map', height=600, **kwargs)
¶
Initializes a map. More info at https://plotly.com/python/mapbox-layers/
Parameters:
Name | Type | Description | Default |
---|---|---|---|
center
|
tuple
|
Center of the map. Defaults to (20, 0). |
(20, 0)
|
zoom
|
float
|
Zoom level of the map. Defaults to 1. |
1
|
basemap
|
str
|
Can be one of string from "open-street-map", "carto-positron", "carto-darkmatter", "stamen-terrain", "stamen-toner" or "stamen-watercolor" . Defaults to 'open-street-map'. |
'open-street-map'
|
height
|
int
|
Height of the map. Defaults to 600. |
600
|
Source code in leafmap/plotlymap.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
add_basemap(basemap='ROADMAP')
¶
Adds a basemap to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
basemap
|
str
|
Can be one of string from basemaps. Defaults to 'ROADMAP'. |
'ROADMAP'
|
Source code in leafmap/plotlymap.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|
add_choropleth_map(data, name=None, z=None, colorscale='Viridis', **kwargs)
¶
Adds a choropleth map to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
str
|
File path to vector data, e.g., https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/countries.geojson |
required |
name
|
str
|
Name of the layer. Defaults to None. |
None
|
z
|
str
|
Z value of the data. Defaults to None. |
None
|
colorscale
|
str
|
Color scale of the data. Defaults to "Viridis". |
'Viridis'
|
Source code in leafmap/plotlymap.py
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
|
add_cog_layer(url, name='Untitled', attribution='', opacity=1.0, bands=None, titiler_endpoint=None, **kwargs)
¶
Adds a COG TileLayer to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The URL of the COG tile layer, e.g., 'https://github.com/opengeos/data/releases/download/raster/Libya-2023-07-01.tif' |
required |
name
|
str
|
The layer name to use for the layer. Defaults to 'Untitled'. |
'Untitled'
|
attribution
|
str
|
The attribution to use. Defaults to ''. |
''
|
opacity
|
float
|
The opacity of the layer. Defaults to 1. |
1.0
|
bands
|
list
|
The bands to use. Defaults to None. |
None
|
titiler_endpoint
|
str
|
Titiler endpoint. Defaults to "https://titiler.xyz". |
None
|
**kwargs
|
Arbitrary keyword arguments, including bidx, expression, nodata, unscale, resampling, rescale,
color_formula, colormap, colormap_name, return_mask. See https://developmentseed.org/titiler/endpoints/cog/
and https://cogeotiff.github.io/rio-tiler/colormap/. To select a certain bands, use bidx=[1, 2, 3].
apply a rescaling to multiple bands, use something like |
{}
|
Source code in leafmap/plotlymap.py
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
|
add_controls(controls)
¶
Adds controls to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
controls
|
list
|
List of controls to add, e.g., ['drawline', 'drawopenpath', 'drawclosedpath', 'drawcircle', 'drawrect', 'eraseshape'] See https://bit.ly/33Tmqxr |
required |
Source code in leafmap/plotlymap.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
add_gdf(gdf, label_col=None, color_col=None, labels=None, opacity=1.0, zoom=None, color_continuous_scale='Viridis', **kwargs)
¶
Adds a GeoDataFrame to the map. Args: gdf (GeoDataFrame): A GeoDataFrame. label_col (str, optional): The column name of locations. Defaults to None. color_col (str, optional): The column name of color. Defaults to None.
Source code in leafmap/plotlymap.py
714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 |
|
add_geojson(data, name, type, color, opacity)
¶
Add layers to the Map
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict
|
Geojson in Dict form |
required |
name
|
str
|
Name for the Layer |
required |
color
|
str
|
Plain name for color (e.g: blue) or color code (e.g: #FF0000) |
required |
opacity(float,
|
optional
|
opacity of the layer in Map |
required |
Source code in leafmap/plotlymap.py
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 |
|
add_geojson_layer(geojson_in, name, color='blue', opacity=1)
¶
Prepare proper and give style for different type of Geometry
Parameters:
Name | Type | Description | Default |
---|---|---|---|
in_geojson
|
str | dict
|
The file path or http URL to the input GeoJSON or a dictionary containing the geojson. |
required |
name
|
str
|
Name for the Layer |
required |
color
|
str
|
Plain name for color (e.g: blue) or color code (e.g: #FF0000) |
'blue'
|
opacity(float,
|
optional
|
opacity of the layer in Map |
required |
Source code in leafmap/plotlymap.py
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
|
add_heatmap(data, latitude='latitude', longitude='longitude', z='value', radius=10, colorscale=None, name='Heat map', **kwargs)
¶
Adds a heat map to the map. Reference: https://plotly.com/python/mapbox-density-heatmaps
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
str | DataFrame
|
File path or HTTP URL to the input file or a . For example, https://raw.githubusercontent.com/plotly/datasets/master/earthquakes-23k.csv |
required |
latitude
|
str
|
The column name of latitude. Defaults to "latitude". |
'latitude'
|
longitude
|
str
|
The column name of longitude. Defaults to "longitude". |
'longitude'
|
z
|
str
|
The column name of z values. Defaults to "value". |
'value'
|
radius
|
int
|
Radius of each “point” of the heatmap. Defaults to 25. |
10
|
colorscale
|
str
|
Color scale of the data, e.g., Viridis. See https://plotly.com/python/builtin-colorscales. Defaults to None. |
None
|
name
|
str
|
Layer name to use. Defaults to "Heat map". |
'Heat map'
|
Source code in leafmap/plotlymap.py
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 |
|
add_heatmap_demo(**kwargs)
¶
Adds a heatmap to the map.
Source code in leafmap/plotlymap.py
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 |
|
add_layer(layer, name=None, **kwargs)
¶
Adds a layer to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer
|
graph_objects
|
Layer to add. |
required |
name
|
str
|
Name of the layer. Defaults to None. |
None
|
Source code in leafmap/plotlymap.py
235 236 237 238 239 240 241 242 243 244 |
|
add_mapbox_layer(style, access_token=None)
¶
Adds a mapbox layer to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer
|
str | dict
|
Layer to add. Can be "basic", "streets", "outdoors", "light", "dark", "satellite", or "satellite-streets". See https://plotly.com/python/mapbox-layers/ and https://docs.mapbox.com/mapbox-gl-js/style-spec/ |
required |
access_token
|
str
|
The Mapbox Access token. It can be set as an environment variable "MAPBOX_TOKEN". Defaults to None. |
None
|
Source code in leafmap/plotlymap.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
|
add_mosaic_layer(url, titiler_endpoint=None, name='Mosaic Layer', attribution='', opacity=1.0, **kwargs)
¶
Adds a STAC TileLayer to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
HTTP URL to a MosaicJSON. |
required |
titiler_endpoint
|
str
|
Titiler endpoint, e.g., "https://titiler.xyz". Defaults to None. |
None
|
name
|
str
|
The layer name to use for the layer. Defaults to 'Mosaic Layer'. |
'Mosaic Layer'
|
attribution
|
str
|
The attribution to use. Defaults to ''. |
''
|
opacity
|
float
|
The opacity of the layer. Defaults to 1. |
1.0
|
Source code in leafmap/plotlymap.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 |
|
add_planet_by_month(year=2016, month=1, api_key=None, token_name='PLANET_API_KEY', name=None, attribution='', opacity=1.0)
¶
Adds Planet global mosaic by month to the map. To get a Planet API key, see https://developers.planet.com/quickstart/apis/
Parameters:
Name | Type | Description | Default |
---|---|---|---|
year
|
int
|
The year of Planet global mosaic, must be >=2016. Defaults to 2016. |
2016
|
month
|
int
|
The month of Planet global mosaic, must be 1-12. Defaults to 1. |
1
|
api_key
|
str
|
The Planet API key. Defaults to None. |
None
|
token_name
|
str
|
The environment variable name of the API key. Defaults to "PLANET_API_KEY". |
'PLANET_API_KEY'
|
name
|
str
|
Name of the layer. Defaults to 'TileLayer'. |
None
|
attribution
|
str
|
The attribution to use. Defaults to "". |
''
|
opacity
|
float
|
The opacity of the layer. Defaults to 1. |
1.0
|
Source code in leafmap/plotlymap.py
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
|
add_planet_by_quarter(year=2016, quarter=1, api_key=None, token_name='PLANET_API_KEY', name=None, attribution='', opacity=1.0)
¶
Adds Planet global mosaic by month to the map. To get a Planet API key, see https://developers.planet.com/quickstart/apis/
Parameters:
Name | Type | Description | Default |
---|---|---|---|
year
|
int
|
The year of Planet global mosaic, must be >=2016. Defaults to 2016. |
2016
|
quarter
|
int
|
The quarter of Planet global mosaic, must be 1-4. Defaults to 1. |
1
|
api_key
|
str
|
The Planet API key. Defaults to None. |
None
|
token_name
|
str
|
The environment variable name of the API key. Defaults to "PLANET_API_KEY". |
'PLANET_API_KEY'
|
name
|
str
|
Name of the layer. Defaults to 'TileLayer'. |
None
|
attribution
|
str
|
The attribution to use. Defaults to "". |
''
|
opacity
|
float
|
The opacity of the layer. Defaults to 1. |
1.0
|
Source code in leafmap/plotlymap.py
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 |
|
add_scatter_plot_demo(**kwargs)
¶
Adds a scatter plot to the map.
Source code in leafmap/plotlymap.py
598 599 600 601 602 603 604 605 |
|
add_stac_layer(url=None, collection=None, items=None, assets=None, bands=None, titiler_endpoint=None, name='STAC Layer', attribution='', opacity=1.0, **kwargs)
¶
Adds a STAC TileLayer to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
HTTP URL to a STAC item, e.g., https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json |
None
|
collection
|
str
|
The Microsoft Planetary Computer STAC collection ID, e.g., landsat-8-c2-l2. |
None
|
items
|
str
|
The Microsoft Planetary Computer STAC item ID, e.g., LC08_L2SP_047027_20201204_02_T1. |
None
|
assets
|
str | list
|
The Microsoft Planetary Computer STAC asset ID, e.g., ["SR_B7", "SR_B5", "SR_B4"]. |
None
|
bands
|
list
|
A list of band names, e.g., ["SR_B7", "SR_B5", "SR_B4"] |
None
|
titiler_endpoint
|
str
|
Titiler endpoint, e.g., "https://titiler.xyz", "planetary-computer", "pc". Defaults to None. |
None
|
name
|
str
|
The layer name to use for the layer. Defaults to 'STAC Layer'. |
'STAC Layer'
|
attribution
|
str
|
The attribution to use. Defaults to ''. |
''
|
opacity
|
float
|
The opacity of the layer. Defaults to 1. |
1.0
|
Source code in leafmap/plotlymap.py
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
|
add_tile_layer(url, name='TileLayer', attribution='', opacity=1.0, **kwargs)
¶
Adds a TileLayer to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The URL of the tile layer. |
required |
name
|
str
|
Name of the layer. Defaults to 'TileLayer'. |
'TileLayer'
|
attribution
|
str
|
The attribution to use. Defaults to "". |
''
|
opacity
|
float
|
The opacity of the layer. Defaults to 1. |
1.0
|
Source code in leafmap/plotlymap.py
375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
|
clear_controls()
¶
Removes all controls from the map.
Source code in leafmap/plotlymap.py
138 139 140 141 142 143 144 145 146 147 |
|
clear_layers(clear_basemap=False)
¶
Clears all layers from the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
clear_basemap
|
bool
|
If True, clears the basemap. Defaults to False. |
False
|
Source code in leafmap/plotlymap.py
259 260 261 262 263 264 265 266 267 268 269 |
|
find_layer_index(name)
¶
Finds the index of a layer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the layer to find. |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Index of the layer. |
Source code in leafmap/plotlymap.py
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
|
get_data_layers()
¶
Returns a dictionary of data layers in the map.
Returns:
Name | Type | Description |
---|---|---|
dict |
Dict
|
A dictionary of data layers in the map. |
Source code in leafmap/plotlymap.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
|
get_layers()
¶
Returns a dictionary of all layers in the map. Returns: dict: A dictionary of all layers in the map.
Source code in leafmap/plotlymap.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
|
get_tile_layers()
¶
Returns a dictionary of tile layers in the map.
Returns:
Name | Type | Description |
---|---|---|
dict |
Dict
|
A dictionary of tile layers in the map. |
Source code in leafmap/plotlymap.py
288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
|
remove_basemap(name)
¶
Removes a basemap from the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the basemap to remove. |
required |
Source code in leafmap/plotlymap.py
210 211 212 213 214 215 216 217 218 |
|
remove_controls(controls)
¶
Removes controls to the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
controls
|
list
|
List of controls to remove, e.g., ["zoomin", "zoomout", "toimage", "pan", "resetview"]. See https://bit.ly/3Jk7wkb |
required |
Source code in leafmap/plotlymap.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
remove_layer(name)
¶
Removes a layer from the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the layer to remove. |
required |
Source code in leafmap/plotlymap.py
246 247 248 249 250 251 252 253 254 255 256 257 |
|
save(file, format=None, width=None, height=None, scale=None, **kwargs)
¶
Convert a map to a static image and write it to a file or writeable object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file
|
str
|
A string representing a local file path or a writeable object (e.g. a pathlib.Path object or an open file descriptor) |
required |
format
|
str
|
The desired image format. One of png, jpg, jpeg, webp, svg, pdf, eps. Defaults to None. |
None
|
width
|
int
|
The width of the exported image in layout pixels. If the |
None
|
height
|
int
|
The height of the exported image in layout pixels. If the |
None
|
scale
|
int
|
The scale factor to use when exporting the figure. A scale factor larger than 1.0 will increase the image resolution with respect to the figure's layout pixel dimensions. Whereas as scale factor of less than 1.0 will decrease the image resolution.. Defaults to None. |
None
|
Source code in leafmap/plotlymap.py
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 |
|
set_center(lat, lon, zoom=None)
¶
Sets the center of the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lat
|
float
|
Latitude. |
required |
lon
|
float
|
Longitude. |
required |
zoom
|
int
|
Zoom level of the map. Defaults to None. |
None
|
Source code in leafmap/plotlymap.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
set_layer_opacity(name, opacity=1)
¶
Sets the visibility of a layer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the layer to set. |
required |
opacity
|
float
|
Opacity of the layer. Defaults to 1. |
1
|
Source code in leafmap/plotlymap.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
|
set_layer_visibility(name, show=True)
¶
Sets the visibility of a layer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the layer to set. |
required |
show
|
bool
|
If True, shows the layer. Defaults to True. |
True
|
Source code in leafmap/plotlymap.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
show(toolbar=True, map_min_width='91%', map_max_width='98%', refresh=False, **kwargs)
¶
Shows the map.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
toolbar
|
bool
|
Whether to show the toolbar. Defaults to True. |
True
|
map_min_width
|
str
|
The minimum width of the map. Defaults to '91%'. |
'91%'
|
map_max_width
|
str
|
The maximum width of the map. Defaults to '98%'. |
'98%'
|
refresh
|
bool
|
Whether to refresh the map when the map is resized. Defaults to False. |
False
|
Returns:
Name | Type | Description |
---|---|---|
Canvas |
None
|
Map canvas. |
Source code in leafmap/plotlymap.py
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 |
|
fix_widget_error()
¶
Fix FigureWidget - 'mapbox._derived' Value Error. Adopted from: https://github.com/plotly/plotly.py/issues/2570#issuecomment-738735816
Source code in leafmap/plotlymap.py
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 |
|