Consider the following line (GeoJSON):
{
"type": "FeatureCollection",
"name": "longline",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 12.999790298013979, 51.989991736063956 ], [ 13.00086345470789, 51.989982154307761 ], [ 13.000786800658325, 51.989560557035155 ], [ 13.001649158715933, 51.989541393522764 ], [ 13.001725812765498, 51.989982154307761 ], [ 13.002703151897455, 51.989924663770587 ], [ 13.002559425554519, 51.98948390298559 ], [ 13.003623000492237, 51.989742610402871 ], [ 13.003402620099736, 51.990432496848953 ], [ 13.002894787021367, 51.990604968460474 ], [ 13.003479274149301, 51.991016983976891 ] ] } }
]
}
I have a second line that coincides exactly with a part of the longer line:
{
"type": "FeatureCollection",
"name": "shortline",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "LineString", "coordinates": [ [ 12.999790298013979, 51.989991736063956 ], [ 13.000461224116039, 51.989985745652334 ] ] } }
]
}
What I'd like to do is erasing that shorter part from the longer line.
This needs to be done in a web application, so I cannot use desktop software or server-side scripts.
I am open to a pure JavaScript solution or to a solution that involves Turf.js.
Keep in mind that the shorter line might have multiple vetices (not just start and end).