Skip to main content

GeoPandas AI is an extension of GeoPandas allowing you to interact with your spatial data in natural language.

Project description

GeoPandas AI

GeoPandas AI is a powerful Python library that brings natural language processing capabilities to your geospatial data analysis workflow. It allows you to interact with GeoDataFrames using natural language queries, making geospatial analysis more accessible and intuitive.

Features

  • Natural language interaction with GeoDataFrames
  • Support for multiple LLM providers through LiteLLM
  • Built-in support for Jupyter notebooks

Installation

pip install geopandas-ai

Quick Start

GeoPandas AI is designed to work seamlessly with GeoPandas. Most function available in GeoPandas are also available in GeoPandas AI.

Example Usage 1

import geopandasai as gpdai

gdfai = gpdai.read_file("path/to/your/geodatafile.geojson")

gdfai.chat("Plot the data")
gdfai.improve("Change the title to something more selling and add a basemap")

Example Usage 2

import geopandasai as gpdai

gdfai = gpdai.read_file("path/to/your/geodatafile.geojson")

gdfai.chat("Plot the data").chat("Change the title to something more selling and add a basemap")

Configuration

GeoPandas AI uses LiteLLM to support multiple LLM providers. You can configure your preferred provider in two ways:

  1. Using the set_active_lite_llm_config function:
from geopandasai import set_active_lite_llm_config

set_active_lite_llm_config({
    "model": "your_model_name",
    # Add provider-specific configuration
})
  1. Using environment variables:
export LITELLM_CONFIG='{"model": "your_model_name", ...}'

Please refer to https://docs.litellm.ai/docs/providers for more details on configuring LiteLLM.

Adding Custom Libraries

GeoPandas AI allows you to extend its capabilities by adding custom libraries that can be used in the generated code. There are two ways to add libraries:

  1. Globally using set_libraries:
from geopandasai import set_libraries

# Add libraries that will be available for all chat queries
set_libraries(['numpy', 'scipy', 'shapely'])
  1. Per-query using the user_provided_libraries parameter:
# Add libraries for a specific query
result = gdfai.chat(
    "calculate the convex hull using scipy",
    user_provided_libraries=['scipy', 'numpy']
)

By default, the following libraries are always available:

  • pandas
  • matplotlib.pyplot
  • folium
  • geopandas
  • contextily

Note: Make sure any additional libraries you specify are installed in your environment.

Requirements

  • Python 3.8+
  • GeoPandas
  • LiteLLM
  • Matplotlib
  • Folium
  • Contextily

License

MIT + Commercial Platform Restriction (see LICENSE.md)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geopandas_ai-0.0.21.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geopandas_ai-0.0.21-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file geopandas_ai-0.0.21.tar.gz.

File metadata

  • Download URL: geopandas_ai-0.0.21.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for geopandas_ai-0.0.21.tar.gz
Algorithm Hash digest
SHA256 c42f8d3d5f8ddcb255a0eb547c78c20f8c9f99d9d283a72f3b91ff5580765dc5
MD5 42b877533f03b80a2952c457e2e7774b
BLAKE2b-256 97dfc2dd46e87ab14c22d1e20326c1c1cfb9558a10a5cea8dd5a7fcd823f23cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for geopandas_ai-0.0.21.tar.gz:

Publisher: python-publish.yml on GaspardMerten/geopandas-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geopandas_ai-0.0.21-py3-none-any.whl.

File metadata

  • Download URL: geopandas_ai-0.0.21-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for geopandas_ai-0.0.21-py3-none-any.whl
Algorithm Hash digest
SHA256 5579a4ad0ce0cef6d1b3ced3ceb97b711ad55aa17a5e5afc563af9a0b61706a6
MD5 db3a0e952561654f52c4b7baaee86a10
BLAKE2b-256 e54a96d90c32c100d9f7a088c2dfb89bfb9880b58d8162c1f1ba86d76f10bd45

See more details on using hashes here.

Provenance

The following attestation bundles were made for geopandas_ai-0.0.21-py3-none-any.whl:

Publisher: python-publish.yml on GaspardMerten/geopandas-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page