leafmap - A Python package for geospatial analysis and interactive mapping in a Jupyter environment.

Overview

Welcome to leafmap

image image image image image image image image image image

A Python package for geospatial analysis and interactive mapping in a Jupyter environment.

Introduction

leafmap is a Python package for geospatial analysis and interactive mapping 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 a GEE account. leafmap is designed to fill this gap for non-GEE users. It enables users to perform advanced geospatial analysis and interactive mapping with minimal coding in a Jupyter environment (e.g., Google Colab, JupyterLab, Jupyter notebook). It is built upon a number of 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 interface).

The WhiteboxTools library currently contains 447 tools, which are each grouped based on their main function into one of the following categories. For a list of available tools with comprehensive documentation and usage details, please see the WhiteboxTools User Manual.

Launch the interactive notebook tutorial for the leafmap Python package with Google Colab or Binder now:

image image

Key Features

Below is a partial list of features available for the leafmap package. Please check the examples page for notebook examples, GIF animations, and video tutorials.

  • Create an interactive map with only one-line of code.
  • Select from a variety of basemaps interactively without coding.
  • Add XYZ and WMS tile services to the map.
  • Convert CSV to points and display points as a marker cluster.
  • Add local vector data (e.g., shapefile, GeoJSON, KML) to the map without coding.
  • Add local raster data (e.g., GeoTIFF) to the map without coding.
  • Add Cloud Optimized GeoTIFF (COG) and SpatialTemporal Asset Catalog (STAC) to the map.
  • Add custom legends and colorbars to the map.
  • Perform geospatial analysis using WhiteboxTools and whiteboxgui.
  • Publish interactive maps with only one line of code.

Demo

YouTube Channel

I have created a YouTube Channel for sharing geospatial tutorials. You can subscribe to my channel for regular updates. If there is any specific tutorial you would like to see, please submit a feature request here.

Earth Engine Tutorials on YouTube

Comments
  • Install on Pyodide/JupyterLite

    Install on Pyodide/JupyterLite

    It would be really cool to run leafmap on Pyodide and hence JupyterLite using micropip.

    I gave it a try and found basically two issues with non-existing Python 3 source wheels (needed by micropip) for pycrs and pyshp on PyPI for which I've created these tickets (but there might be wheels for them hosted somewhere else): https://github.com/karimbahgat/PyCRS/issues/56 and https://github.com/GeospatialPython/pyshp/issues/217. And here-map-widget-for-jupyter can be installed, too, but still has some issue with the JupyterLab extension, as described on https://github.com/heremaps/here-map-widget-for-jupyter/issues/25. Folium can be installed in a somewhat complicated manner, see the notebook pyolite folium.ipynb on JupyterLite.

    Not sure if anything else is needed... ;)

    help wanted Feature Request 
    opened by deeplook 20
  • QGIS Layer export TIF on leafmap

    QGIS Layer export TIF on leafmap

    Hi I am able to get the 03 COG STAC tutorial working using your provided tif files, but when I use the QGIS exported file, I am unable to see any bound values and when trying to run the leafmap it gives me this error

    image

    bug 
    opened by Niko-La 14
  • Generalize the titiler_endpoint parameter

    Generalize the titiler_endpoint parameter

    Currently, the default titiler_endpoint is https://api.cogeo.xyz/. It would be useful to generalize the titiler_endpointso that users can provide a custom endpoint. @TomAugspurger

    For example, Microsoft Planetary Computer has its own titiler endpoint at https://planetarycomputer.microsoft.com/api/data/v1/docs#/. Ideally, the add_cog_layer() function should be able to automatically detect if the notebook is running within Planetary Computer (e.g., import planetary-computer is successful) and use the custom endpoint.

    https://leafmap.org/leafmap/#leafmap.leafmap.Map.add_cog_layer https://leafmap.org/leafmap/#leafmap.leafmap.Map.add_cog_mosaic

    https://planetarycomputer.microsoft.com/api/data/v1

    Feature Request 
    opened by giswqs 14
  • Add support for visualizing LiDAR data

    Add support for visualizing LiDAR data

    References:

    • https://github.com/laspy/laspy
    • https://github.com/isl-org/Open3D
    • https://medium.com/spatial-data-science/an-easy-way-to-work-and-visualize-lidar-data-in-python-eed0e028996c
    Feature Request 
    opened by giswqs 11
  • plotly colab import error

    plotly colab import error

    image

    looks like colab is giving issue.

    Environment Information

    • leafmap version:
    • Python version:
    • Operating System:

    Description

    Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.

    What I Did

    Paste the command(s) you ran and the output.
    If there was a crash, please include the traceback here.
    
    bug 
    opened by Niko-La 10
  • ImageOverlay from local files

    ImageOverlay from local files

    Add a new ImageOverlay class that extends ipyleaflet.ImageOverlay for supporting local files.

    Reference: https://github.com/banesullivan/localtileserver/issues/25 @deeplook

    Feature Request 
    opened by giswqs 10
  • Added support for bokeh #298

    Added support for bokeh #298

    This PR adds bokeh as a new plotting backend. Currently, it supports adding basemaps, loading COG and local raster datasets. Supporting for loading vector data is in progress.

    import leafmap.bokehmap as leafmap
    m = leafmap.Map()
    m.add_basemap('ROADMAP')
    url = 'https://opendata.digitalglobe.com/events/california-fire-2020/pre-event/2018-02-16/pine-gulch-fire20/1030010076004E00.tif'
    m.add_cog_layer(url)
    m
    

    Peek 2022-11-07 16-06

    Feature Request 
    opened by giswqs 9
  • Added two functions to add and check styles for different type of geo…

    Added two functions to add and check styles for different type of geo…

    …metries

    Please inform me if any further changes are required. e.g:

    • m.add_geojson_layer('local_geojson_url','layer1','red')
    • m.add_geojson_layer('https://raw.githubusercontent.com/plotly/datasets/master/geojson-counties-fips.json','layer2')
    opened by rowheat02 9
  • Can't add a Geotiff raster layer to the map

    Can't add a Geotiff raster layer to the map

    Environment Information

    • leafmap version: 0.1.0
    • Python version: 3.7.10
    • Operating System: Windows

    Description

    After installing xarray-leaflet, I tried to add a Geotiff raster layer to the map.

    Once the file is chosen, I press the apply button and the map zooms to the right coordinates, a layer is created but nothing is displayed.

    I'm attaching the file I'm trying to display so you can try on your own.

    file.zip

    bug 
    opened by mamoev 9
  • style_callback param for add_geojson() not working?

    style_callback param for add_geojson() not working?

    Environment Information

    • leafmap version: 0.5.0
    • Python version: 3.9
    • Operating System: Linux/macOS

    Description

    I want to use the style_callback parameter for map.add_geojson(), but the chosen style which sets only the color seems not to be respected. I think the style dicts are the same for ipyleaflet and leafmap, at least I could not find any contradictory information. See below.

    import requests
    data = requests.get((
        "https://raw.githubusercontent.com/telegeography/www.submarinecablemap.com"
        "/master/web/public/api/v3/cable/cable-geo.json"
    )).json()
    callback = lambda feat: {"color": feat["properties"]["color"]}
    
    import leafmap
    m = leafmap.Map(center=[0, 0], zoom=2)
    m.add_geojson(data, style_callback=callback)
    m.layout.height = "100px"
    m
    
    Screen Shot 2021-10-03 at 11 12 53
    import ipyleaflet
    m = ipyleaflet.Map(center=[0, 0], zoom=2)
    m += ipyleaflet.GeoJSON(data=data, style_callback=callback)
    m.layout.height = "100px"
    m
    
    Screen Shot 2021-10-03 at 11 14 14 bug 
    opened by deeplook 8
  • get the coordinates of a user-drawn polygon

    get the coordinates of a user-drawn polygon

    First of all, congratulations Dr. Qiusheng for your fantastic work !

    I became a 100% geemap user and one of the very useful functions when working with feature exploration (1) is to manually draw a polygon in an area of interest, (2) extract the coordinates with Map.draw_last_feature and then (3) export this polygon as a shapefile or even a featureCollection in the case of ee.

    I looked for something similar in the leafmap but I couldn't find it, although it is possible to easily draw the polygon and see its individual points, but it seems to me that there is a lack of a similar routine to manipulate the coordinates extracted from the map.

    That would be of great value. Best wishes Andre

    Feature Request 
    opened by andrebelem 8
  • Input data from OGCAPI endpoints

    Input data from OGCAPI endpoints

    Description

    Allow simple connection to be vector data served from OGCAPI-Features endpoints. Potentially also OGCAPI-Tiles similar to WMS function.

    Imagined functionality: User provides endpoint and collection or juster endpoint to the collection - https://ogcapi.bgs.ac.uk/collections/bgsgeology625kbedrock

    Source code

    Potentially use OWSLib package to pull data?

    Feature Request 
    opened by KoalaGeo 1
  • Panoply netCDF, HDF and GRIB Data Viewer

    Panoply netCDF, HDF and GRIB Data Viewer

    The Panoply app is quite interesting. It would be great to have some similar functionality in leafmap.

    • https://www.giss.nasa.gov/tools/panoply/
    • http://soliton.vm.bytemark.co.uk/pub/cpt-city/
    • https://www.ventusky.com/

    image

    Feature Request 
    opened by giswqs 0
  • Making interactive hillshade maps

    Making interactive hillshade maps

    • https://github.com/banesullivan/localtileserver-demo/blob/main/hillshade.ipynb
    • https://www.neonscience.org/resources/learning-hub/tutorials/create-hillshade-py
    • https://www.whiteboxgeo.com/manual/wbt_book/available_tools/geomorphometric_analysis.html?highlight=shaded#multidirectionalhillshade
    • https://earthpy.readthedocs.io/en/latest/gallery_vignettes/plot_dem_hillshade.html
    Feature Request 
    opened by giswqs 0
  • Add support for ipybertin

    Add support for ipybertin

    ipybertin is a new mapping library. It would be great to add it as a new plotting backend.

    • https://github.com/davidbrochart/ipybertin
    • https://github.com/neocarto/bertin

    Peek 2022-06-28 11-29

    Feature Request 
    opened by giswqs 0
Releases(v0.15.0)
Owner
Qiusheng Wu
Assistant Professor of Geography at the University of Tennessee, Knoxville
Qiusheng Wu
a Geolocator made in python

Geolocator A Geolocator made in python ✨ Features locates ur location using ur ip thats it! 💁‍♀️ How to use first download the locator.py file instal

Portgas D Ace 1 Oct 27, 2021
Geodata extensions for Django REST Framework

Django-Spillway Django and Django REST Framework integration of raster and feature based geodata. Spillway builds on the immensely marvelous Django RE

Brian Galey 62 Jan 04, 2023
WIP: extracting Geometry utilities from datacube-core

odc.geo This is still work in progress. This repository contains geometry related code extracted from Open Datacube. For details and motivation see OD

Open Data Cube 34 Jan 09, 2023
A utility to search, download and process Landsat 8 satellite imagery

Landsat-util Landsat-util is a command line utility that makes it easy to search, download, and process Landsat imagery. Docs For full documentation v

Development Seed 681 Dec 07, 2022
Django model field that can hold a geoposition, and corresponding widget

django-geoposition A model field that can hold a geoposition (latitude/longitude), and corresponding admin/form widget. Prerequisites Starting with ve

Philipp Bosch 324 Oct 17, 2022
Tool to suck data from ArcGIS Server and spit it into PostgreSQL

chupaESRI About ChupaESRI is a Python module/command line tool to extract features from ArcGIS Server map services. Name? Think "chupacabra" or "Chupa

John Reiser 34 Dec 04, 2022
Pandas Network Analysis: fast accessibility metrics and shortest paths, using contraction hierarchies :world_map:

Pandana Pandana is a Python library for network analysis that uses contraction hierarchies to calculate super-fast travel accessibility metrics and sh

Urban Data Science Toolkit 321 Jan 05, 2023
pure-Python (Numpy optional) 3D coordinate conversions for geospace ecef enu eci

Python 3-D coordinate conversions Pure Python (no prerequistes beyond Python itself) 3-D geographic coordinate conversions and geodesy. API similar to

Geospace code 292 Dec 29, 2022
Python module to access the OpenCage geocoding API

OpenCage Geocoding Module for Python A Python module to access the OpenCage Geocoder. Build Status / Code Quality / etc Usage Supports Python 3.6 or n

OpenCage GmbH 57 Nov 01, 2022
Bacon - Band-limited Coordinate Networks for Multiscale Scene Representation

BACON: Band-limited Coordinate Networks for Multiscale Scene Representation Project Page | Video | Paper Official PyTorch implementation of BACON. BAC

Stanford Computational Imaging Lab 144 Dec 29, 2022
Xarray backend to Copernicus Sentinel-1 satellite data products

xarray-sentinel WARNING: this product is a "technology preview" / pre-Alpha Xarray backend to explore and load Copernicus Sentinel-1 satellite data pr

B-Open 191 Dec 15, 2022
Construct and use map tile grids in different projection.

Morecantile +-------------+-------------+ ymax | | | | x: 0 | x: 1 | | y: 0 | y: 0

Development Seed 67 Dec 23, 2022
Specification for storing geospatial vector data (point, line, polygon) in Parquet

GeoParquet About This repository defines how to store geospatial vector data (point, lines, polygons) in Apache Parquet, a popular columnar storage fo

Open Geospatial Consortium 449 Dec 27, 2022
Manage your XYZ Hub or HERE Data Hub spaces from Python.

XYZ Spaces for Python Manage your XYZ Hub or HERE Data Hub spaces and Interactive Map Layer from Python. FEATURED IN: Online Python Machine Learning C

HERE Technologies 30 Oct 18, 2022
Track International space station with python

NASA-ISS-tracker Track International space station with python Modules import json import turtle import urllib.request import time import webbrowser i

Nikhil Yadav 8 Aug 12, 2021
Python project to generate Kerala's distrcit level panchayath map.

Kerala-Panchayath-Maps Python project to generate Kerala's distrcit level panchayath map. As of now, geojson files of Kollam and Kozhikode are added t

Athul R T 2 Jan 10, 2022
Satellite imagery for dummies.

felicette Satellite imagery for dummies. What can you do with this tool? TL;DR: Generate JPEG earth imagery from coordinates/location name with public

Shivashis Padhi 1.8k Jan 03, 2023
User friendly Rasterio plugin to read raster datasets.

rio-tiler User friendly Rasterio plugin to read raster datasets. Documentation: https://cogeotiff.github.io/rio-tiler/ Source Code: https://github.com

372 Dec 23, 2022
Manipulation and analysis of geometric objects

Shapely Manipulation and analysis of geometric objects in the Cartesian plane. Shapely is a BSD-licensed Python package for manipulation and analysis

3.1k Jan 03, 2023
How to use COG's (Cloud optimized GeoTIFFs) with Rasterio

How to use COG's (Cloud optimized GeoTIFFs) with Rasterio According to Cogeo.org: A Cloud Opdtimized GeoTIFF (COG) is a regular GeoTIFF file, aimed at

Marvin Gabler 8 Jul 29, 2022