A library to create interactive maps of geographical datasets.
Project description
A library to create interactive maps of geographical datasets.
- 🌍 EOmaps provides a simple and intuitive interface to visualize and interact with geographical datasets
- ⬥ Data can be provided as 1D or 2D
lists
,numpy-arrays
orpandas.DataFrames
- ... usable also for large datasets with > 1M datapoints!
- ⬥ WebMap layers, annotations, markers can be added with a single line of code
- ⬥ EOmaps is built on top of
matplotlib
andcartopy
and integrates wellpandas
andgeopandas
- 🌎 Quickly turn your maps into powerful interactive data-analysis widgets
- ⬥ use callback functions to interact with the data (or an underlying database)
- ⬥ compare multiple data-layers, WebMaps etc.
🌲🌳 Checkout the documentation for more details and examples 🌳🌲
🔨 Installation
To install EOmaps (and all its dependencies) via the conda
package-manager, simply use:
conda install -c conda-forge eomaps
For more information, have a look at the installation instructions in the documentation!
🚀 Contribute
Found a bug or got an idea for an interesting feature? Open an issue or start a discussion and I'll see what I can do!
(I'm of course also happy about actual pull requests on features and bug-fixes!)
🌳 Basic usage
- A list of coordinates and values is all you need as input!
- plots of large (>1M datapoints) irregularly sampled datasets are generated in a few seconds!
- Represent your data as shapes with actual geographic dimensions (ellipses, rectangles, geodetic circles)
- or use Voroni diagrams and Delaunay triangulations to get interpolated contour-plots
- Re-project the data to any crs supported by cartopy
- ... and get a nice colorbar with a colored histogram on top!
import pandas as pd
from eomaps import Maps
# the data you want to plot
lon, lat, data = [1,2,3,4,5], [1,2,3,4,5], [1,2,3,4,5]
# initialize Maps object
m = Maps(crs=Maps.CRS.Orthographic())
# set the data
m.set_data(data=data, xcoord=lon, ycoord=lat, crs=4326)
# set the shape you want to use to represent the data-points
m.set_shape.geod_circles(radius=10000) # (e.g. geodetic circles with 10km radius)
# (optionally) set the appearance of the plot
m.set_plot_specs(cmap="viridis", label="a nice label")
# (optionally) classify the data
m.set_classify_specs(scheme=Maps.CLASSIFIERS.Quantiles, k=5)
# plot the map
m.plot_map()
# (optionally) add a colorbar
m.add_colorbar()
# ---- add another plot-layer to the map
m2 = m.new_layer()
...
...
🌌 advanced usage
[click to show] 🛸 Checkout the docs! 🛸
🌍 Attach callback functions to interact with the plot
- Many pre-defined functions for common tasks are available!
- display coordinates and values, add markers, compare data-layers etc.
- ... or define your own function and attach it to the plot!
- Maps objects can be interactively connected to analyze relations between datasets!
# get a nice annotation if you click on a datapoint
m.cb.pick.attach.annotate()
# draw a marker if you click on a datapoint
m.cb.pick.attach.mark(facecolor="r", edgecolor="g", shape="rectangles", radius=1, radius_crs=4326)
# show the data-layer `1` in a inset-rectangle (size=20% width of the axes) if you click on the map
m.cb.click.attach.peek_layer(how=0.2, layer=1)
#attach some custom function to interact with the map
m.cb.click.attach(<... a custom function ...>)
# show the data-layer `1` if you press "a" on the keyboard and the layer `0` if you press "q"
m.cb.keypress.attach.switch_layer(layer=0, key="q")
m.cb.keypress.attach.switch_layer(layer=1, key="a")
🌕 Add additional layers and overlays
- many pre-defined interfaces for WebMap servers exist
- OpenStreetMap
- ESA WorldCover
- Nasa GIBS
- S1GBM
- ... and more!
m.add_wms(...) # add WebMapService layers
m.add_gdf(...) # add geopandas.GeoDataFrames
m.add_feature.<group>.<feature>() # add feature-layers from NaturalEarth
m.add_colorbar(...) # add a colorbar to the map
m.add_annotation(...) # add static annotations
m.add_marker(...) # add static markers
🪐 Save the figure
m.savefig("oooh_what_a_nice_figure.png", dpi=300)
🌗 Connect Maps-objects to get multiple interactive layers of data
m = Maps()
...
m.plot_map()
m2 = m.new_layer(layer=2)
m2.set_data(...)
m2.set_shape(...)
...
m2.plot_map() # plot another layer of data
m2.cb.attach.peek_layer(layer=2, how=0.25)
🌏 Plot grids of maps
from eomaps import MapsGrid
mgrid = MapsGrid(2, 2, crs=3857)
for m in mgrid:
m.plot_specs.label = "asdf"
mgrid.ax_0_0.add_feature.preset.ocean()
mgrid.ax_0_1.add_feature.preset.land()
mgrid.ax_1_0.add_feature.preset.coastline()
mgrid.ax_1_1.add_feature.preset.countries()
mgrid.plot_map() # call m.plot_map() on all Maps-objects of the grid
mgrid.join_limits() # join limits
🌼 Thanks to
- Jakob Quast for designing the nice logo!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
EOmaps-3.0.tar.gz
(173.8 kB
view hashes)
Built Distribution
EOmaps-3.0-py3-none-any.whl
(173.4 kB
view hashes)