GeoPolars Documentation

repository·main·Indexed 21 days ago

https://github.com/pola-rs/geopolars

A geospatial extension for the Polars DataFrame library providing high-performance geospatial data processing for Rust and Python. Built on the GeoArrow memory model, it features multithreading capabilities and a pure-Rust core. Current version 0.1.0-alpha.4 is a prototype and not production-ready. Includes the GeoDataFrame and GeoSeries classes, GIS vector file reading via read_file, and conversion utilities for Arrow, GeoPandas, NumPy, and Pandas.

Tokens
5.2K
Snippets
22
Records
46
Agent score
75%

What's inside GeoPolars

  1. What is GeoPolars?

    main

    GeoPolars is an extension of the Polars DataFrame library designed for geospatial data. It aims to provide:

    1. High Performance: Faster multithreaded operations compared to GeoPandas.
    2. Interoperability: Better data interoperability without memory copies by utilizing a GeoArrow core.

    Note: GeoPolars is currently a prototype and is not considered production-ready.

  2. Overview of GeoPolars

    main

    GeoPolars is a geospatial extension for the Polars DataFrame library. It provides geospatial capabilities for both Rust and Python, utilizing the GeoArrow memory model for internal data representation.

    Key Features:

    • Internal Memory Model: Uses GeoArrow.
    • Implementation: Written in Rust with Python bindings.
    • Performance: Multithreading capable.
    WARNING

    GeoPolars is currently a prototype and is not considered production-ready.

  3. Explore the GeoPolars Python API Reference

    main

    The geopolars namespace contains all public objects, functions, and methods. The API is organized into several core modules:

    • GeoSeries: For handling 1D geospatial data.
    • GeoDataFrame: For handling 2D geospatial datasets.
    • GeoLazyFrame: For deferred/lazy geospatial operations.
    • Expressions: For defining geospatial transformations within Polars-style contexts.
    • Functions: For standalone geospatial utility functions.
    • IO: For reading and writing geospatial data formats.
    • Datatypes: For geospatial-specific data types.
    • Config: For library configuration.
    • Testing: For geospatial testing utilities.
    • Exceptions: For geospatial-specific error handling.
  4. GeoPolars vs GeoPandas

    main
    While GeoPandas is a production-ready tool built on shapely and GEOS, GeoPolars is a prototype designed with a pure-Rust core. This architecture makes GeoPolars a strong candidate for future WebAssembly (Wasm) support, which is a long-term goal for the project.
  5. Build GeoPolars for development

    main

    To build the project for development, use the poe develop command. This uses Maturin to build and package the Python and Rust code into a Python wheel and installs it into the Poetry-managed virtual environment (.venv/).

    Note: This command compiles the Rust binary with --debug flags. While compilation is faster, runtime performance will be significantly slower.

    To build with a release configuration (faster runtime, slower compilation), use:

    poetry run poe develop-release

    After building, you can verify the installation by opening IPython:

    poetry run ipython

    Inside IPython, you should be able to run import geopolars successfully.

    poetry run poe develop
  6. Deploy documentation versions

    main

    GeoPolars uses mike to deploy documentation, allowing multiple versions to be hosted simultaneously.

    To deploy a specific version and set it as the latest version, use the following pattern:

    # Deploy a specific version as latest
    poetry run mike deploy --push --no-redirect 0.1.0-alpha.4 latest
    
    # Deploy the 'latest' alias
    poetry run mike deploy --push --no-redirect VERSION latest
    poetry run mike deploy --push --no-redirect 0.1.0-alpha.4 latest