Skip to main content

Overview

The linref library builds on tabular and geospatial libraries pandas and geopandas to provide powerful features for linearly referenced data management, manipulation, and analysis. Using a modern pandas accessor pattern (.lr), linref seamlessly extends DataFrames with linear referencing capabilities while maintaining full compatibility with existing pandas/geopandas workflows.

At its core, linref uses:

  • LRS (Linear Referencing System) objects to define the schema of your linearly referenced data

  • EventsData as the underlying computational engine for efficient linear operations

  • DataFrame accessor pattern (.lr) for intuitive, pandas-like syntax

  • Optimized implementations powered by numpy, shapely, and scipy

Some of the main features of this library include:

  • Event data engineering - Merge consecutive events with df.lr.dissolve(), create uniform segments with df.lr.resegment(), and project point and linear data onto linearly referenced data

  • Data conflation operations - Create relationships between datasets with df.lr.relate() and aggregate data by attributes, counts, and more using count and length-weighted methods

  • Geometry operations - Generate geometries from mile markers, extract mile markers from geometries, and perform spatial linear referencing operations

  • Integration - Combine multiple event datasets into unified linearly referenced frameworks

  • Prepare and run in-depth analyses - Built-in support for advanced analyses such as high-injury networks, intersection influence areas, and more through simple, well-documented methods

Getting Started

Installation

Install linref using pip:

pip install linref

Basic Concepts

Linear Referencing System (LRS)

An LRS defines the schema of your linearly referenced data by specifying which columns represent:

  • Key columns key_col - One or more unique route identifier or grouping columns (e.g., ‘Route’, ‘County’)

  • Chain column chain_col - An optional column for chain indices that identify contiguous geometry groups within each route, extending standard key columns to avoid non-contiguous groups

  • Measure columns - For point events use loc_col (e.g., ‘Milepost’), for linear events beg_col and end_col (e.g., ‘Begin_Milepost’, ‘End_Milepost’)

  • Geometry columns - For spatial data geom_col and for spatial data that is m-enabled geom_m_col (generally m-enabled geometries are prepared and managed by linref)

  • Closure type closed - How range endpoints are handled: ‘left’, ‘right’, ‘both’, ‘neither’, or ‘left_mod’/’right_mod’

Documentation

Release files for linref 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for linref 1.0.0
File Size Uploaded
linref-1.0.0.tar.gz 98.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for linref 1.0.0
File Interpreter ABI Platform
linref-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 205.7 kB

Release files / linref-1.0.0.tar.gz

Download URL linref-1.0.0.tar.gz
Size 98.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b65507c277daee1df401c52218a34f37ad8b512824e872fe415cca6ac3be3d6d
BLAKE2b-256 checksum
How to use checksums
4bc30ce13dfbcd8403fd5878ff59eacb60b1404cd28401c74b65007ee9ae91fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.

Transparency log

Release files / linref-1.0.0-py3-none-any.whl

Download URL linref-1.0.0-py3-none-any.whl
Size 107.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
582410427349e5f231a1f29afb65fb8b89026419371146f985b0d586494b8a20
BLAKE2b-256 checksum
How to use checksums
2ed20654b090f8390681e73bfe3b8ff3d7c480f57061ca8be752e41ae608ab04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 10, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.2

1 release file

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page