Scroll to navigation



ogrlineref - Create linear reference and provide some calculations using it.


ogrlineref [--help-general] [-progress] [-quiet]

[-f format_name] [[-dsco NAME=VALUE] ...] [[-lco NAME=VALUE]...]
[-l src_line_datasource_name] [-ln layer_name] [-lf field_name]
[-p src_repers_datasource_name] [-pn layer_name] [-pm pos_field_name] [-pf field_name]
[-r src_parts_datasource_name] [-rn layer_name]
[-o dst_datasource_name] [-on layer_name] [-of field_name] [-s step]
[-get_pos] [-x long] [-y lat]
[-get_coord] [-m position]
[-get_subline] [-mb position] [-me position]


The ogrlineref program can be used for:

  • create linear reference file from input data
  • return the "linear referenced" distance for the projection of the input coordinates (point) on the path
  • return the coordinates (point) on the path according to the "linear referenced" distance
  • return the portion of the path according to the "linear referenced" begin and end distances

The ogrlineref creates a linear reference - a file containing a segments of special length (e.g. 1 km in reference units) and get coordinates, linear referenced distances or sublines (subpaths) from this file. The utility not required the M or Z values in geometry. The results can be stored in any OGR supported format. Also some information is written to the stdout.

Show the usage.

Show progress.

Suppress all messages except errors and results.

Select an output format name. The default is to create a shapefile.

Dataset creation option (format specific)

Layer creation option (format specific).

Create the linear reference file (linestring of parts).

The path to input linestring datasource (e.g. the road)

The layer name in datasource

The field name of unique values to separate the input lines (e.g. the set of roads).

The path to linear references points (e.g. the road mile-stones)

The layer name in datasource

The field name of distances along path (e.g. mile-stones values)

The field name of unique values to map input reference points to lines.

The path to linear reference file.

The layer name in datasource

The path to output linear reference file (linestring datasource)

The layer name in datasource

The field name for storing the unique values of input lines

The part size in linear units

Return linear referenced position for input X, Y

Input X coordinate

Input Y coordinate

Return point on path for input linear distance

The input linear distance

Return the portion of the input path from and to input linear positions.

The input begin linear distance

The input end linear distance


This example would create a shapefile (parts.shp) containing a data needed for linear referencing (1 km parts):

ogrlineref -create -l roads.shp -p references.shp -pm dist -o parts.shp -s 1000 -progress


Dmitry Baryshnikov <>



January 2, 2023