Greppo Python Framework: Build Geospatial Web Apps Fast

6月2日 Published inDeveloper Tools

Greppo is an open-source Python framework designed for developing geospatial web applications. It streamlines the integration of data, algorithms, and visualizations into an interactive interface, allowing for rapid deployment. Under the hood, Greppo leverages powerful open-source tools including Starlette, Vue, and Leaflet. Licensed under Apache V2, the project provides a comprehensive package that includes the frontend, core library files, and configuration documentation.

Greppo Installation

Basic Installation

You can install Greppo directly via pip:

pip install greppo

We recommend using a virtual environment to manage your dependencies and keep your workspace clean. Here is how to set it up using virtualenv:

pip3 install virtualenv
virtualenv ENV
source ENV/bin/activate
pip install greppo
# When you are finished
deactivate

Windows Users

Installing Fiona—a primary dependency for Greppo—can sometimes be problematic on Windows. To resolve this, download the appropriate pre-compiled wheel from Christoph Gohlke’s unofficial binaries page and install it manually. This typically bypasses common installation errors.

Greppo Quick Start

Project Setup

Begin by creating a project directory and a main script file:

mkdir my-greppo-app
cd my-greppo-app
touch app.py

Basic Application Code

1. Geospatial data visualization (app.py)

from greppo import app
import geopandas as gpd

# Load geospatial data
data_gdf = gpd.read_file("geospatial_data.geojson")
buildings_gdf = gpd.read_file("./data/buildings.geojson")

# Add an overlay layer
app.overlay_layer(
    buildings_gdf,
    name="Buildings",
    description="Buildings in an Amsterdam neighborhood",
    style={"fillColor": "#F87979"},
    visible=True,
)

# Add a base layer
app.base_layer(
    name="OpenStreetMap",
    visible=True,
    url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
    attribution='&copy; <a target="_blank" href="http://osm.org/copyright">OpenStreetMap</a> contributors',
)

2. Adding interactive parameters (app.py)

from greppo import app
import numpy as np

# Create an adjustable number input
x = app.number(name="x", value=3)
# Print a list using the current value
print('Value list: ', np.ones(10) * x)

Running Greppo

Start the server from your command line:

greppo serve app.py

Open your web browser and navigate to localhost:8080. Check your terminal output to confirm the exact port. Your application will be live and interactive.

Greppo Features

Greppo provides developers with robust tools for layer control, data visualization, custom styling, and interactive application logic. For detailed technical information, visit the full documentation at docs.greppo.io.

If you need support or wish to contribute, visit the official website at greppo.io, join the Discord community at discord.gg/RNJBjgh8gz, or explore the source code on GitHub at [github.com/greppo-io/greppo](https://github.com/greppo-io/greppo).

Greppo is built upon several high-performance open-source projects: Starlette (web framework), Vue (frontend views), Leaflet (map rendering), ChartJS (charts), and TailwindCSS (styling).