basemaps module¶
Module for basemaps.
Each basemap is defined as an item in the basemaps
dictionary.
More WMS basemaps can be found at the following websites:
- USGS National Map: https://viewer.nationalmap.gov/services/
- MRLC NLCD Land Cover data: https://viewer.nationalmap.gov/services/
- FWS NWI Wetlands data: https://www.fws.gov/wetlands/Data/Web-Map-Services.html
GoogleMapsTileProvider
¶
Bases: TileProvider
Google Maps TileProvider.
Source code in geemap/basemaps.py
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 |
|
__init__(map_type='roadmap', language='en-Us', region='US', api_key=None, **kwargs)
¶
Generates Google Map tiles using the provided parameters. To get an API key
and enable Map Tiles API, visit
https://developers.google.com/maps/get-started#create-project.
You can set the API key using the environment variable
GOOGLE_MAPS_API_KEY
or by passing it as an argument.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
map_type
|
str
|
The type of map to generate. Options are 'roadmap', 'satellite', 'terrain', 'hybrid', 'traffic', 'streetview'. Defaults to 'roadmap'. |
'roadmap'
|
language
|
str
|
An IETF language tag that specifies the language used to display information on the tiles, such as 'zh-Cn'. Defaults to 'en-Us'. |
'en-Us'
|
region
|
str
|
A Common Locale Data Repository region identifier (two uppercase letters) that represents the physical location of the user. Defaults to 'US'. |
'US'
|
api_key
|
str
|
The API key to use for the Google Maps API. If not provided, it will try to get it from the environment or Colab user data with the key 'GOOGLE_MAPS_API_KEY'. Defaults to None. |
None
|
**kwargs
|
Any
|
Additional parameters to pass to the map generation. For more info, visit https://bit.ly/3UhbZKU |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
If the API key is not provided and cannot be found in the environment or Colab user data. |
ValueError
|
If the map_type is not one of the allowed types. |
Example
from geemap.basemaps import GoogleMapsTileProvider m = geemap.Map() basemap = GoogleMapsTileProvider(map_type='roadmap', language="en-Us", region="US", scale="scaleFactor2x", highDpi=True) m.add_basemap(basemap)
Returns:
Type | Description |
---|---|
TileProvider object: A TileProvider object with the Google Maps tile. |
Source code in geemap/basemaps.py
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 |
|
get_google_map_tile_providers(language='en-Us', region='US', api_key=None, **kwargs)
¶
Generates a dictionary of Google Map tile providers for different map types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
language
|
str
|
An IETF language tag that specifies the language used to display information on the tiles, such as 'zh-Cn'. Defaults to 'en-Us'. |
'en-Us'
|
region
|
str
|
A Common Locale Data Repository region identifier (two uppercase letters) that represents the physical location of the user. Defaults to 'US'. |
'US'
|
api_key
|
str
|
The API key to use for the Google Maps API. If not provided, it will try to get it from the environment or Colab user data with the key 'GOOGLE_MAPS_API_KEY'. Defaults to None. |
None
|
**kwargs
|
Any
|
Additional parameters to pass to the map generation. For more info, visit https://bit.ly/3UhbZKU |
{}
|
Returns:
Name | Type | Description |
---|---|---|
dict |
A dictionary where the keys are the map types |
|
('roadmap', 'satellite', 'terrain', 'hybrid') |
||
and the values are the corresponding GoogleMapsTileProvider objects. |
Source code in geemap/basemaps.py
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 |
|
get_xyz_dict(free_only=True, france=False)
¶
Returns a dictionary of xyz services.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
free_only
|
bool
|
Whether to return only free xyz tile services that do not require an access token. Defaults to True. |
True
|
france
|
bool
|
Whether to include Geoportail France basemaps. Defaults to False. |
False
|
Returns:
Name | Type | Description |
---|---|---|
dict |
A dictionary of xyz services. |
Source code in geemap/basemaps.py
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 |
|
qms_to_geemap(service_id)
¶
Convert a qms service to an ipyleaflet tile layer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_id
|
str
|
Service ID. |
required |
Returns:
Type | Description |
---|---|
ipyleaflet.TileLayer: An ipyleaflet tile layer. |
Source code in geemap/basemaps.py
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 |
|
search_qms(keywords, limit=10)
¶
Search qms files for keywords. Reference: https://github.com/geopandas/xyzservices/issues/65
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keywords
|
str
|
Keywords to search for. |
required |
limit
|
int
|
Number of results to return. |
10
|
Source code in geemap/basemaps.py
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
|
xyz_to_folium()
¶
Convert xyz tile services to folium tile layers.
Returns:
Name | Type | Description |
---|---|---|
dict |
A dictionary of folium tile layers. |
Source code in geemap/basemaps.py
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 |
|
xyz_to_leaflet()
¶
Convert xyz tile services to ipyleaflet tile layers.
Returns:
Name | Type | Description |
---|---|---|
dict |
A dictionary of ipyleaflet tile layers. |
Source code in geemap/basemaps.py
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 |
|
xyz_to_plotly()
¶
Convert xyz tile services to plotly tile layers.
Returns:
Name | Type | Description |
---|---|---|
dict |
A dictionary of plotly tile layers. |
Source code in geemap/basemaps.py
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 |
|
xyz_to_pydeck()
¶
Convert xyz tile services to pydeck custom tile layers.
Returns:
Name | Type | Description |
---|---|---|
dict |
A dictionary of pydeck tile layers. |
Source code in geemap/basemaps.py
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 |
|