Rendering maps at different zoomlevels

I’m trying to render maps to animate gpx data of a bicycle race. To fullfill the specs I was given I decided to render the maps myself from .osm.pbf extracts.

When exteacting the data I need I ran into a problem.

There seem to be different resolutions of the same river in my data extracts from Geofabrik and I could not figure out if there are tags I could use to filter and use the different Ways at different zoomlevels.

Anyone have an idea how osm renders their tiles?

That doesn’r sound aa if you are actually looking at raw OSM data in PBF format. Have you perhaps downloaded a set of vectortiles?

https://switch2osm.org/ might help with a general overview.

I think you’ll need to go into a bit more detail about what you’re doing …

… like exactly which river and while files from Geofabrik.

There are currently 8 sets of tiles directly selectable from osm.org, and 5 (ish) different sorts of toolchains involved, two of which could reasonably be described as “osm”. What is best for you depends completely on what else you want to do - if you’re using a design that would work well with Leaflet but not with MapLibre (or vice versa) then that might influence which way to go.

What have you tried so far?

Update:
I think vector tiles are the better approach. So I reimplemented my program using the vectortiles from vector.openstreetmap.org.
But the bug remained. Which is when I realized that I closed every way before rendering because I copy-pasted some code from the rendering of areas.

My other approach would have worked. Vector tiles are still nicer because the rendering at different scales is already done for me.