Return only one segment

Hey,

The API works fine!

I have a question about how segments work which I couldn’t find in the documentation for the call to /v2/directions/{profile}/geojson

I usually have plots with 40 or 50 coordinates. Is it possible to return only one segment to have the clearest possible directions? Because today it returns me a segment by intermediate coordinate, which displays a lot of “Arrive at…” :

"segments": [
                    {
                        "distance": 1387.6,
                        "duration": 999.1,
                        "steps": [
                            {
                                "distance": 1387.6,
                                "duration": 999.1,
                                "type": 11,
                                "instruction": "Head northeast on Rue du Bréau, D 31",
                                "name": "Rue du Bréau, D 31",
                                "way_points": [
                                    0,
                                    12
                                ]
                            },
                            {
                                "distance": 0.0,
                                "duration": 0.0,
                                "type": 10,
                                "instruction": "Arrive at Rue du Bréau, D 31, on the right",
                                "name": "-",
                                "way_points": [
                                    12,
                                    12
                                ]
                            }
                        ],
                        "ascent": 0.4064754486084041,
                        "descent": 4.2738758087158715
                    },
                    {
                        "distance": 2225.0,
                        "duration": 1602.0,
                        "steps": [
                            {
                                "distance": 1498.2,
                                "duration": 1078.7,
                                "type": 11,
                                "instruction": "Head northeast on D 31",
                                "name": "D 31",
                                "way_points": [
                                    12,
                                    39
                                ]
                            },
                            {
                                "distance": 63.3,
                                "duration": 45.6,
                                "type": 0,
                                "instruction": "Turn left onto D 141",
                                "name": "D 141",
                                "way_points": [
                                    39,
                                    42
                                ]
                            },
                            {
                                "distance": 11.4,
                                "duration": 8.2,
                                "type": 1,
                                "instruction": "Turn right",
                                "name": "-",
                                "way_points": [
                                    42,
                                    43
                                ]
                            },
                            {
                                "distance": 68.5,
                                "duration": 49.3,
                                "type": 0,
                                "instruction": "Turn left",
                                "name": "-",
                                "way_points": [
                                    43,
                                    47
                                ]
                            },
                            {
                                "distance": 237.6,
                                "duration": 171.1,
                                "type": 1,
                                "instruction": "Turn right onto D 141",
                                "name": "D 141",
                                "way_points": [
                                    47,
                                    55
                                ]
                            },
                            {
                                "distance": 261.5,
                                "duration": 188.2,
                                "type": 1,
                                "instruction": "Turn right onto Rue Sourde",
                                "name": "Rue Sourde",
                                "way_points": [
                                    55,
                                    62
                                ]
                            },
                            {
                                "distance": 84.5,
                                "duration": 60.8,
                                "type": 1,
                                "instruction": "Turn right onto Rue du Grand Bezout",
                                "name": "Rue du Grand Bezout",
                                "way_points": [
                                    62,
                                    65
                                ]
                            },
                            {
                                "distance": 0.0,
                                "duration": 0.0,
                                "type": 10,
                                "instruction": "Arrive at Rue du Grand Bezout, on the right",
                                "name": "-",
                                "way_points": [
                                    65,
                                    65
                                ]
                            }
                        ],
                        "ascent": 7.145066442489622,
                        "descent": 4.6890909099578835
                    }
                ],

If there is a way or technique to change this, that would be perfect for me!

Thank you for you precious help.

Hey,

I assume your problem stems from using intermediate “via”-waypoints to more finely control the actual routing between your start- and endpoint? If not, I understood your “plots with 40 or 50 coordinates” incorrectly.

However, if so, then there is currently no option to control what waypoints contribute to the routing instruction description and what waypoints don’t.

To get what I think you’d want, you’d have to filter any “arrive at”-description that does not correspond to the last point of your route, and concatenate all other routing instructions.
You could probably also add some filtering on the routing instructions directly before and after your “Goal”-step (compare types), and simplify your response a bit more via this.

Best regards