kraina-ai/srai

Spatial Representations for Artificial Intelligence - a Python library toolkit for geospatial machine learning focused on creating embeddings for downstream tasks

What it solves

SRAI is a Python library designed to standardize the process of creating spatial representations for machine learning. It simplifies the complex workflow of acquiring geospatial vector data, dividing geographic areas into manageable micro-regions, and converting those regions into vector embeddings that can be used for downstream AI tasks.

How it works

The library implements a pipeline consisting of four main stages:

  1. Data Acquisition: It provides loaders for OpenStreetMap (OSM) and Overture Maps, as well as tools to extract features from General Transit Feed Specification (GTFS) public transport data.
  2. Regionalization: It divides a target area into smaller units using various algorithms, such as Uber's H3 (hexagons), Google's S2 (quad-cells), Voronoi diagrams, or administrative boundaries.
  3. Joining: It maps the acquired spatial features to the specific micro-regions created during regionalization.
  4. Embedding: It transforms the joined data into vector spaces using various methods, including Hex2Vec, GTFS2Vec, Highway2Vec, and count-based embeddings. Some of these methods utilize PyTorch models and can be trained or loaded as pre-trained models.

Who it’s for

Data scientists and AI researchers focusing on geospatial machine learning, urban planning, and any application requiring the conversion of raw geographic vector data into machine-learnable vector representations.

Highlights

  • Multi-source data loading: Integrated support for OSM, Overture Maps, and GTFS.
  • Flexible regionalization: Support for multiple grid systems (H3, S2) and custom boundaries.
  • Diverse embedding algorithms: Implements several research-backed methods like Hex2Vec and Highway2Vec to capture spatial context.
  • PyTorch integration: Ability to fit and transform data using torch-based embedders.
  • Built-in datasets: Includes prepared datasets and benchmarks for testing downstream tasks.

Related

  • Project
  • Project
  • Project
  • Project
  • Project