Skip to content

Commit

Permalink
Split modules into core and extra features (gee-community#1601)
Browse files Browse the repository at this point in the history
* Split modules into core and extra features

* Split the basemaps module

* Improve docs

* Add ee_tile_layers module to docs

* Improve module docs

* Update toolbar module

* Update the common module
  • Loading branch information
giswqs authored Jul 3, 2023
1 parent c6a5cb2 commit db70e1e
Show file tree
Hide file tree
Showing 22 changed files with 10,483 additions and 11,067 deletions.
3 changes: 3 additions & 0 deletions docs/ee_tile_layers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ee_tile_layers module

::: geemap.ee_tile_layers
94 changes: 56 additions & 38 deletions geemap/basemaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
"""

# *******************************************************************************#
# This module contains core features and extra features of the geemap package. #
# The Earth Engine team and the geemap community will maintain the core features.#
# The geemap community will maintain the extra features. #
# The core features include classes and functions below until the line # ******* #
# *******************************************************************************#

import collections
import os
import requests
Expand Down Expand Up @@ -283,44 +290,6 @@ def xyz_to_leaflet():
return leaflet_dict


def xyz_to_pydeck():
"""Convert xyz tile services to pydeck custom tile layers.
Returns:
dict: A dictionary of pydeck tile layers.
"""

check_package("pydeck", "https://deckgl.readthedocs.io/en/latest/installation.html")
import pydeck as pdk

pydeck_dict = {}

for key, tile in custom_tiles["xyz"].items():
url = tile["url"]
pydeck_dict[key] = url

for key, item in get_xyz_dict().items():
url = item.build_url()
pydeck_dict[key] = url

if os.environ.get("PLANET_API_KEY") is not None:
planet_dict = planet_tiles(tile_format="ipyleaflet")
for id_, tile in planet_dict.items():
pydeck_dict[id_] = tile.url

pdk.settings.custom_libraries = [
{
"libraryName": "MyTileLayerLibrary",
"resourceUri": "https://cdn.jsdelivr.net/gh/giswqs/pydeck_myTileLayer@master/dist/bundle.js",
}
]

for key in pydeck_dict:
pydeck_dict[key] = pdk.Layer("MyTileLayer", pydeck_dict[key], key)

return pydeck_dict


def xyz_to_folium():
"""Convert xyz tile services to folium tile layers.
Expand Down Expand Up @@ -368,6 +337,55 @@ def xyz_to_folium():
return folium_dict


# ******************************************************************************#
# The classes and functions above are the core features of the geemap package. #
# The Earth Engine team and the geemap community will maintain these features. #
# ******************************************************************************#

# ******************************************************************************#
# The classes and functions below are the extra features of the geemap package. #
# The geemap community will maintain these features. #
# ******************************************************************************#


def xyz_to_pydeck():
"""Convert xyz tile services to pydeck custom tile layers.
Returns:
dict: A dictionary of pydeck tile layers.
"""

check_package("pydeck", "https://deckgl.readthedocs.io/en/latest/installation.html")
import pydeck as pdk

pydeck_dict = {}

for key, tile in custom_tiles["xyz"].items():
url = tile["url"]
pydeck_dict[key] = url

for key, item in get_xyz_dict().items():
url = item.build_url()
pydeck_dict[key] = url

if os.environ.get("PLANET_API_KEY") is not None:
planet_dict = planet_tiles(tile_format="ipyleaflet")
for id_, tile in planet_dict.items():
pydeck_dict[id_] = tile.url

pdk.settings.custom_libraries = [
{
"libraryName": "MyTileLayerLibrary",
"resourceUri": "https://cdn.jsdelivr.net/gh/giswqs/pydeck_myTileLayer@master/dist/bundle.js",
}
]

for key in pydeck_dict:
pydeck_dict[key] = pdk.Layer("MyTileLayer", pydeck_dict[key], key)

return pydeck_dict


def xyz_to_plotly():
"""Convert xyz tile services to plotly tile layers.
Expand Down
8 changes: 8 additions & 0 deletions geemap/cartoee.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
"""The cartoee module contains functions for creating publication-quality maps with cartopy and Earth Engine data."""

# *******************************************************************************#
# This module contains extra features of the geemap package. #
# The geemap community will maintain the extra features. #
# *******************************************************************************#


import logging
import os
import subprocess
Expand Down
5 changes: 5 additions & 0 deletions geemap/chart.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
"""Module for creating charts for Earth Engine data.
"""

# *******************************************************************************#
# This module contains core features of the geemap package. #
# The Earth Engine team and the geemap community will maintain the core features.#
# *******************************************************************************#

import ee
import pandas as pd
import numpy as np
Expand Down
7 changes: 7 additions & 0 deletions geemap/colormaps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
"""Module for commonly used colormaps and palettes for visualizing Earth Engine data.
"""

# *******************************************************************************#
# This module contains extra features of the geemap package. #
# The geemap community will maintain the extra features. #
# *******************************************************************************#


import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
Expand Down
Loading

0 comments on commit db70e1e

Please sign in to comment.