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
Examples: See the examples section for step-by-step Jupyter notebook tutorials
API Reference: See the API reference for detailed class and method documentation
Release Notes: See the changelog for detailed version history
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)
| File | Size | Uploaded | |
|---|---|---|---|
| linref-1.0.0.tar.gz | 98.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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 logRelease 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