OGRLINEREF(1)

πŸ’– OGRLINEREF(1) πŸ’–

okay bestie, gather round, because this is the GDAL tool that does linear referencing and honestly? it eats. it's the ogrlineref utility, and by the end of this page you're gonna be obsessed. no cap.


✨ NAME ✨

ogrlineref β€” create a linear reference and do some calculations with it. that's the whole vibe. πŸŽ€


🌸 SYNOPSIS 🌸

ogrlineref [--help] [--help-general] [-progress] [-quiet]
           [-f <format_name>] [-dsco <NAME>=<VALUE>]... [-lco <NAME>=<VALUE>]...
           [-create]
           [-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>]

πŸ¦‹ DESCRIPTION πŸ¦‹

so like… what does ogrlineref actually do? here's the tea, the program can be used to:

  • create a 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 utility creates a linear reference β€” a file containing segments of a certain length (e.g. 1 km in reference units, like, imagine that πŸ’…). the user can get coordinates, linear referenced distances or sublines (subpaths) from this file. the utility does not require the M or Z components in the geometry. the results can be stored in any OGR supported format. also some information is written to the stdout. slay.

πŸŽ€ the options, one by one, no skips πŸŽ€

  • --help β€” shows this help message and exits. bye bestie πŸ‘‹
  • --help-general β€” gives a brief usage message for the generic GDAL commandline options and exits. the normie GDAL stuff.
  • -progress β€” show progress. we love a progress bar, it's giving main character energy πŸ”₯
  • -q, --quiet β€” suppress progress messages and other non-error output. silent but deadly fr fr πŸ’€
  • -f <format_name> β€” select an output format name. the default is to create a shapefile. classic, iconic, timeless.
  • -dsco <NAME>=<VALUE> β€” dataset creation option (format specific). one of these per thing, use as many as you need.
  • -lco <NAME>=<VALUE> β€” layer creation option (format specific).
  • -create β€” create the linear reference file (linestring of parts). the whole point, honestly 🌟
  • -l <src_line_datasource_name> β€” the path to input linestring datasource (e.g. the road) πŸ›£οΈ
  • -ln <layer_name> β€” the layer name in datasource.
  • -lf <field_name> β€” the field name of unique values to separate the input lines (e.g. the set of roads). very important for keeping your roads apart, no merging drama πŸ™ˆ
  • -p <src_repers_datasource_name> β€” the path to linear references points (e.g. the road mile-stones) πŸͺ¨
  • -pn <layer_name> β€” the layer name in datasource.
  • -pm <pos_field_name> β€” the field name of distances along path (e.g. mile-stones values).
  • -pf <field_name> β€” the field name of unique values to map input reference points to lines. matchy matchy πŸ’ž
  • -r <src_parts_datasource_name> β€” the path to linear reference file.
  • -rn <layer_name> β€” the layer name in datasource.
  • -o <dst_datasource_name> β€” the path to output linear reference file (linestring datasource).
  • -on <layer_name> β€” the layer name in datasource.
  • -of <field_name> β€” the field name for storing the unique values of input lines.
  • -s <step> β€” the part size in linear units. measure twice, cut once, periodt ✨
  • -get_pos β€” return linear referenced position for input X, Y.
  • -x <long> β€” input X coordinate.
  • -y <lat> β€” input Y coordinate.
  • -get_coord β€” return point on path for input linear distance 🎯
  • -m <position> β€” the input linear distance.
  • -get_subline β€” return the portion of the input path from and to input linear positions. a little slice of path, as a treat πŸ“
  • -mb <position> β€” the input begin linear distance.
  • -me <position> β€” the input end linear distance.

πŸ’€ RETURN STATUS CODE πŸ’€

the program returns status code 0 in case of success, and non-zero in case of error. and no, bestie, don't panic β€” non-blocking errors emitted as warnings are considered as a successful execution. 🫢


🌈 EXAMPLES 🌈

Example 1

this example would create a shapefile (parts.shp) containing a data needed for linear referencing (1 km parts). look at her go:

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

πŸ‘‘ AUTHOR πŸ‘‘

Dmitry Baryshnikov <polimax@mail.ru>


1998-2026


and that's the whole page, bestie β€” written by Dmitry Baryshnikov and brought to you from the GDAL OGRLINEREF(1) era, dated Aug 18, 2026. go reference some lines, you absolute icon. ily, bye πŸ’…βœ¨πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from