Skip to content

Commit

Permalink
Fixed typo gee-community#997
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Mar 29, 2022
1 parent 6d97a08 commit a62c8c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This Get Started guide is intended as a quick way to start programming with **ge

**Geemap** has six plotting backends, including [folium](https://github.com/python-visualization/folium), [ipyleaflet](https://github.com/jupyter-widgets/ipyleaflet), [plotly](https://plotly.com/), [pydeck](https://deckgl.readthedocs.io/en/latest/), [kepler.gl](https://docs.kepler.gl/docs/keplergl-jupyter), and [heremap](https://github.com/heremaps/here-map-widget-for-jupyter). An interactive map created using one of the plotting backends can be displayed in a Jupyter environment, such as Google Colab, Jupyter Notebook, and JupyterLab. By default, `import leafmap` will use the `ipyleaflet` plotting backend.

The six plotting backends do not offer equal functionality. The `ipyleaflet` plotting backend provides the richest interactive functionality, including the custom toolset for loading, analyzing, and visualizing geospatial data interactively without coding. For example, users can add vector data (e.g., GeoJSON, Shapefile, KML, GeoDataFrame) and raster data (e.g., GeoTIFF, Cloud Optimized GeoTIFF [COG]) to the map with a few clicks (see Figure 1). Users can also perform geospatial analysis using the WhiteboxTools GUI with 468 geoprocessing tools directly within the map interface (see Figure 2). Other interactive functionality (e.g., split-panel map, linked map, time slider, time-series inspector) can also be useful for visualizing geospatial data. The `ipyleaflet` package is built upon `ipywidgets` and allows bidirectional communication between the front-end and the backend enabling the use of the map to capture user input ([source](https://blog.jupyter.org/interactive-gis-in-jupyter-with-ipyleaflet-52f9657fa7a)). In contrast, `folium` has relatively limited interactive functionality. It is meant for displaying static data only. Note that the aforementioned custom toolset and interactive functionality are not available for other plotting backends. Compared with `ipyleaflet` and `folium`, the `pydeck`, `kepler.gl`, and `heremap` plotting backend provides some unique 3D mapping functionality. An [API key](https://developer.here.com/documentation/identity-access-management/dev_guide/topics/dev-apikey.html) from the [Here Developer Portal](https://developer.here.com/) is required to use `heremap`.
The six plotting backends do not offer equal functionality. The `ipyleaflet` plotting backend provides the richest interactive functionality, including the custom toolset for loading, analyzing, and visualizing geospatial data interactively without coding. For example, users can add vector data (e.g., GeoJSON, Shapefile, KML, GeoDataFrame) and raster data (e.g., GeoTIFF, Cloud Optimized GeoTIFF [COG]) to the map with a few clicks (see Figure 1). Users can also perform geospatial analysis using the WhiteboxTools GUI with 468 geoprocessing tools directly within the map interface (see Figure 2). Other interactive functionality (e.g., split-panel map, linked map, time slider, time-series inspector) can also be useful for visualizing geospatial data. The `ipyleaflet` package is built upon `ipywidgets` and allows bidirectional communication between the front-end and the backend enabling the use of the map to capture user input ([source](https://blog.jupyter.org/interactive-gis-in-jupyter-with-ipyleaflet-52f9657fa7a)). In contrast, `folium` has relatively limited interactive functionality. It is meant for displaying static data only. Note that the aforementioned custom toolset and interactive functionality are not available for other plotting backends. Compared with `ipyleaflet` and `folium`, the `pydeck`, `kepler.gl`, and `heremap` plotting backend provides some unique 3D mapping functionality. An [API key](https://developer.here.com/documentation/identity-access-management/dev_guide/topics/dev-apikey.html) from the [Here Developer Portal](https://developer.here.com/) is required to use `heremap`.

To choose a specific plotting backend, use one of the following:

Expand Down Expand Up @@ -76,4 +76,4 @@ Map.addLayer(states, {}, "US States")
Once data are added to the map, you can interact with data using various tools, such as the drawing tools, inspector tool, plotting tool.
Check the video below on how to use the Inspector tool to query Earth Engine interactively.

[![geemap](http://img.youtube.com/vi/k477ksjkaXw/0.jpg)](http://www.youtube.com/watch?v=k477ksjkaXw "inspector")
[![geemap](https://img.youtube.com/vi/k477ksjkaXw/0.jpg)](https://www.youtube.com/watch?v=k477ksjkaXw "inspector")
18 changes: 13 additions & 5 deletions geemap/cartoee.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,15 @@ def scale_number(x):
return


def add_legend(ax, legend_elements=None, loc="lower right",font_size=14, font_weight='normal',font_color='black',font_family=None):
def add_legend(
ax,
legend_elements=None,
loc="lower right",
font_size=14,
font_weight='normal',
font_color='black',
font_family=None,
):
"""Adds a legend to the map. The legend elements can be formatted as:
legend_elements = [Line2D([], [], color='#00ffff', lw=2, label='Coastline'),
Line2D([], [], marker='o', color='#A8321D', label='City', markerfacecolor='#A8321D', markersize=10, ls ='')]
Expand Down Expand Up @@ -1045,14 +1053,14 @@ def add_legend(ax, legend_elements=None, loc="lower right",font_size=14, font_we
markerfacecolor="#A8321D",
markersize=10,
ls="",
),g
),
]
if font_family is not None:
fontdict={"family": font_family, "size": font_size, "weight": font_weight}
fontdict = {"family": font_family, "size": font_size, "weight": font_weight}
else:
fontdict={"size": font_size, "weight": font_weight}
fontdict = {"size": font_size, "weight": font_weight}
leg = ax.legend(handles=legend_elements, loc=loc, prop=fontdict)

# Change font color If default color is changed.
if font_color != 'black':
for text in leg.get_texts():
Expand Down

0 comments on commit a62c8c2

Please sign in to comment.