5

I'd like to understand how ogrlineref works but I can't find any examples. I'd like to see the actual "roads.shp" and "references.shp" mentioned in the example invocation:

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

Specifically, I'm unclear on LRS in general and what "dist" column represent in this case. Isn't this tool supposed to produce those values?

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

After this question was answered I converted the shp files to GeoJSON using ogr2ogr:

paths.json

{
"type": "FeatureCollection",
"name": "path",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "id": null, "name": "test" }, "geometry": { "type": "LineString", "coordinates": [ [ -1.449095097755853, 51.912769864393873 ], [ -1.446702601405906, 51.915640860013809 ], [ -1.44742035031089, 51.917554857093762 ], [ -1.444549354690954, 51.923057598698641 ], [ -1.44383160578597, 51.928321090668526 ], [ -1.441199859801029, 51.935020080448375 ], [ -1.439764361991061, 51.941240570958236 ], [ -1.437371865641115, 51.946504062928113 ], [ -1.43402237075119, 51.951767554897998 ], [ -1.431390624766249, 51.955117049787923 ], [ -1.428998128416302, 51.960859041027796 ], [ -1.431629874401244, 51.964687035187708 ], [ -1.43043362622627, 51.966840281902662 ], [ -1.438568113816088, 51.976410267302448 ] ] } }
]
}

mstones.json

{
"type": "FeatureCollection",
"name": "mstones",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "id": null, "pos": 18900.0 }, "geometry": { "type": "Point", "coordinates": [ -1.43761111527611, 51.975214019127471 ] } },
{ "type": "Feature", "properties": { "id": null, "pos": 18100.0 }, "geometry": { "type": "Point", "coordinates": [ -1.432108373671233, 51.968754278982615 ] } },
{ "type": "Feature", "properties": { "id": null, "pos": 16900.0 }, "geometry": { "type": "Point", "coordinates": [ -1.430194376591276, 51.958466544677847 ] } },
{ "type": "Feature", "properties": { "id": null, "pos": 15900.0 }, "geometry": { "type": "Point", "coordinates": [ -1.435697118196153, 51.94937505854805 ] } },
{ "type": "Feature", "properties": { "id": null, "pos": 14900.0 }, "geometry": { "type": "Point", "coordinates": [ -1.440003611626056, 51.940044322783258 ] } },
{ "type": "Feature", "properties": { "id": null, "pos": 13700.0 }, "geometry": { "type": "Point", "coordinates": [ -1.443592356150976, 51.929517338843496 ] } },
{ "type": "Feature", "properties": { "id": null, "pos": 12100.0 }, "geometry": { "type": "Point", "coordinates": [ -1.447659599945885, 51.917076357823774 ] } }
]
}

parts.json

{
"type": "FeatureCollection",
"name": "parts",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "beg": 11759.13883732543, "end": 12000.0, "scale": 9.443966948e-06 }, "geometry": { "type": "LineString", "coordinates": [ [ -1.449095097755853, 51.912769864393873 ], [ -1.449095097755853, 51.912769864393873 ], [ -1.447638879994777, 51.914517325707166 ] ] } },
{ "type": "Feature", "properties": { "beg": 12000.0, "end": 13000.0, "scale": 9.443966948e-06 }, "geometry": { "type": "LineString", "coordinates": [ [ -1.447638879994777, 51.914517325707166 ], [ -1.446702601405906, 51.915640860013809 ], [ -1.44742035031089, 51.917554857093762 ], [ -1.444673955650802, 51.922818780192266 ] ] } },
{ "type": "Feature", "properties": { "beg": 13000.0, "end": 14000.0, "scale": 9.443966948e-06 }, "geometry": { "type": "LineString", "coordinates": [ [ -1.444673955650802, 51.922818780192266 ], [ -1.444549354690954, 51.923057598698641 ], [ -1.44383160578597, 51.928321090668526 ], [ -1.44241931228486, 51.931916019580441 ] ] } },
{ "type": "Feature", "properties": { "beg": 14000.0, "end": 15000.0, "scale": 9.542439841e-06 }, "geometry": { "type": "LineString", "coordinates": [ [ -1.44241931228486, 51.931916019580441 ], [ -1.441199859801029, 51.935020080448375 ], [ -1.439804059060893, 51.941068550322299 ] ] } },
{ "type": "Feature", "properties": { "beg": 15000.0, "end": 16000.0, "scale": 1.0428695878e-05 }, "geometry": { "type": "LineString", "coordinates": [ [ -1.439804059060893, 51.941068550322299 ], [ -1.439764361991061, 51.941240570958236 ], [ -1.437371865641115, 51.946504062928113 ], [ -1.434971803727003, 51.950275588793147 ] ] } },
{ "type": "Feature", "properties": { "beg": 16000.0, "end": 17000.0, "scale": 1.0428695878e-05 }, "geometry": { "type": "LineString", "coordinates": [ [ -1.434971803727003, 51.950275588793147 ], [ -1.43402237075119, 51.951767554897998 ], [ -1.431390624766249, 51.955117049787923 ], [ -1.429698111077124, 51.959179082641825 ] ] } },
{ "type": "Feature", "properties": { "beg": 17000.0, "end": 18000.0, "scale": 1.0428695878e-05 }, "geometry": { "type": "LineString", "coordinates": [ [ -1.429698111077124, 51.959179082641825 ], [ -1.428998128416302, 51.960859041027796 ], [ -1.431629874401244, 51.964687035187708 ], [ -1.43043362622627, 51.966840281902662 ], [ -1.431405181482281, 51.967983288086202 ] ] } },
{ "type": "Feature", "properties": { "beg": 18000.0, "end": 19000.0, "scale": 1.0573304809e-05 }, "geometry": { "type": "LineString", "coordinates": [ [ -1.431405181482281, 51.967983288086202 ], [ -1.438252965636922, 51.976039504738722 ] ] } },
{ "type": "Feature", "properties": { "beg": 19000.0, "end": 19046.579963891814, "scale": 1.0446633156e-05 }, "geometry": { "type": "LineString", "coordinates": [ [ -1.438252965636922, 51.976039504738722 ], [ -1.438568113816088, 51.976410267302448 ] ] } }
]
}
5

You can find sample data for ogrlineref at gdal test data: https://github.com/OSGeo/gdal/tree/master/autotest/utilities/data - path.shp and mstones.shp

An example of ogrlineref using is in test case: https://github.com/OSGeo/gdal/blob/master/autotest/utilities/test_ogrlineref.py

dist column holds the distance in meters (for example this may be milestones value). The references.shp holds points with X and Y coordinates, and dist field hold meters along path (milestone).

Using create switch you create special vector layer which can used in conversion from spatial X,Y coordinates to meters (or kilometers etc.) and vice versa.

You can read about LRS at grass wiki, ESRI help.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.