Skip to content

Commit

Permalink
Merge pull request #1 from sepal-contrib/main
Browse files Browse the repository at this point in the history
first update
  • Loading branch information
12rambau authored Mar 21, 2023
2 parents 3cd873d + 47838f7 commit 67abc27
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 69 deletions.
2 changes: 1 addition & 1 deletion component/message/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"app": {
"title": "sepal leafmap",
"footer": "The sky is the limit \u00a9 {}",
"banner": "This is a automatically generated application. Remove this banner once your application is ready.",
"banner": "This is a wrapper around the leafmap Python librairy. Some functionalities that are bound to jupyter notebook might not work in this interface. Please report issues to https://github.com/12rambau/sepal-leafmap",
"link": {
"code": "Code link",
"wiki": "Documentation and tutorials",
Expand Down
44 changes: 16 additions & 28 deletions component/tile/map_tile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""The map displayed in the map application."""

from ipyleaflet import WidgetControl
import ipyvuetify as v
from ipyleaflet import FullScreenControl, basemaps
from leafmap.leafmap import Map
from sepal_ui import mapping as sm
from sepal_ui import sepalwidgets as sw

Expand All @@ -12,36 +14,22 @@ def __init__(self):
Use this map to gather all your widget and place them on it. It will reduce the amount of work to perform in the notebook
"""
# create a map
self.m = sm.SepalMap(zoom=3) # to be visible on 4k screens
self.m.add_control(
sm.FullScreenControl(
self.m, fullscreen=True, fullapp=True, position="topright"
)
default_basemap = (
basemaps.CartoDB.DarkMatter
if v.theme.dark is True
else basemaps.CartoDB.Positron
)
self.m = Map(basemap=default_basemap, zoom=3)
self.m._id = "leafmap"
self.m.add_class(self.m._id)

# don't add the control to the map simply set it to fullscreen
sm.FullScreenControl(self.m, fullscreen=True, fullapp=True)
self.m.remove_control(
next(c for c in self.m.controls if isinstance(c, FullScreenControl))
)

# create the tile
super().__init__("map_tile", "", [self.m])

def set_code(self, link):
"""Add the code link btn to the map."""
btn = sm.MapBtn("fa-solid fa-code", href=link, target="_blank")
control = WidgetControl(widget=btn, position="bottomleft")
self.m.add(control)

return

def set_wiki(self, link):
"""Add the wiki link btn to the map."""
btn = sm.MapBtn("fa-solid fa-book-open", href=link, target="_blank")
control = WidgetControl(widget=btn, position="bottomleft")
self.m.add(control)

return

def set_issue(self, link):
"""Add the code link btn to the map."""
btn = sm.MapBtn("fa-solid fa-bug", href=link, target="_blank")
control = WidgetControl(widget=btn, position="bottomleft")
self.m.add(control)

return
13 changes: 6 additions & 7 deletions doc/en.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
Panel app
=========
SEPAL leafmap
=============

.. warning::
.. note::

The english documentation of the module have not been set.
This application is providing access to the leafmap Pyhton librairy within as an application.
Please check the `leafmap website <https://leafmap.org/>` for more informations. The authors have published there many examples and video tutorials.

.. tip::

Please open an issue on their repository : https://github.com/12rambau/sepal-leafmap/issues/new
Leafmap is a Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment. It is a spin-off project of the geemap Python package, which was designed specifically to work with Google Earth Engine (GEE). However, not everyone in the geospatial community has access to the GEE cloud computing platform. Leafmap is designed to fill this gap for non-GEE users. It is a free and open-source Python package that enables users to analyze and visualize geospatial data with minimal coding in a Jupyter environment, such as Google Colab, Jupyter Notebook, and JupyterLab. Leafmap is built upon several open-source packages, such as folium and ipyleaflet (for creating interactive maps), WhiteboxTools and whiteboxgui (for analyzing geospatial data), and ipywidgets (for designing interactive graphical user interfaces [GUIs]). Leafmap has a toolset with various interactive tools that allow users to load vector and raster data onto the map without coding. In addition, users can use the powerful analytical backend (i.e., WhiteboxTools) to perform geospatial analysis directly within the leafmap user interface without writing a single line of code. The WhiteboxTools library currently contains 500+ tools for advanced geospatial analysis, such as GIS Analysis, Geomorphometric Analysis, Hydrological Analysis, LiDAR Data Analysis, Mathematical and Statistical Analysis, and Stream Network Analysis.
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ toml
# don't forget to fix it to a specific version when you're app is ready
sepal_ui

# custom libs
# custom libs
leafmap
ipywidgets>=8.0.4
33 changes: 1 addition & 32 deletions ui.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,6 @@
"app_bar = sw.AppBar(cm.app.title, cm)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Gather all the partial tiles that you created previously\n",
"%run 'map_ui.ipynb'\n",
"app_content = [map_tile]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Add the links to the code, wiki and issue tracker of your\n",
"code_link = \"https://github.com/12rambau/sepal-leafmap\"\n",
"wiki_link = \"https://github.com/12rambau/sepal-leafmap/blob/main/doc/en.rst\"\n",
"issue_link = \"https://github.com/12rambau/sepal-leafmap/issues/new\"\n",
"\n",
"# Create the side drawer with all its components\n",
"map_tile.set_code(code_link)\n",
"map_tile.set_wiki(wiki_link)\n",
"map_tile.set_issue(issue_link)"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -57,7 +29,7 @@
"source": [
"# build the Html final app by gathering everything\n",
"app = sw.App(\n",
" tiles=app_content,\n",
" tiles=[tile.MapTile()],\n",
" appBar=app_bar,\n",
" translator=cm,\n",
")"
Expand Down Expand Up @@ -91,9 +63,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
},
"voila": {
"theme": "dark"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 67abc27

Please sign in to comment.