Skip to content

border query parameter is parsed wrong? static/auto/ #2201

Description

@HarelM

I was playing with the ability to style a line using this library to create images for OSM recordings.
I'm using the static/auto/ endpoint.
Since I'm sending a large number of points I'm using the POST request which was recently added.
While playing with this the following didn't work for me:

  1. When setting linecap or linejoin inside the body, these are ignored.
  2. When sending the border color in the query parameters I'm getting an error about invalid color - note the extra "," in the error message, I'm guessing it's a parsing error of some sort.
Invalid border color: white,, skipping border
POST /styles/mapeak-hike/static/auto/128x128.jpg?border=white&linejoin=round&linecap=round&borderwidth=5

So I ended up using the following workaround (C# code):

        var queryParameters = $"styles/mapeak-hike/static/auto/{width}x{height}.jpg?linejoin=round&linecap=round";
        var allPointsString = string.Join("|", dataContainer.Routes.SelectMany(r => r.Segments.SelectMany(s => s.Latlngs)).Select(l => $"{l.Lng},{l.Lat}"));
        var body = new TileServerImageCreatorBody
        {
            Path = "stroke:blue|width:5|border:white|borderwidth:2|" + allPointsString,
        };

The combination above created the expected image.

As a side note, it might be better to have linejoin round as default for lines to prevent weird artifacts as can be seen here:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions