\documentclass[tikz]{standalone}

\usepackage{tikz}
\usepackage{fontspec}
\usepackage{contour}

\setmainfont{Atkinson Hyperlegible}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}

\definecolor{one}{RGB}{237,28,36}
\definecolor{two}{RGB}{17,99,170}
\definecolor{three}{RGB}{255,196,62}
\definecolor{four}{RGB}{0,138,68}
\definecolor{five}{RGB}{246,138,37}
\definecolor{six}{RGB}{64,193,243}
\definecolor{seven}{RGB}{239,36,156}
\definecolor{eight}{RGB}{185,103,198}
\definecolor{nine}{RGB}{115,200,40}
\definecolor{thirty-three}{RGB}{121,54,149}
\definecolor{thirty-nine}{RGB}{191,88,16}
% \definecolor{twentythree}{RGB}{228,142,0}
% \definecolor{twentyfour}{RGB}{140,29,117}
% \definecolor{twentysix}{RGB}{243,155,154}

\input{../shapes.tex}

\pgfdeclarelayer{bg}
\pgfdeclarelayer{lines}
\pgfdeclarelayer{stops}
\pgfdeclarelayer{labels}
\pgfdeclarelayer{legend}
\pgfsetlayers{bg,lines,stops,labels,main,legend}

\contourlength{.2ex}

\begin{document}

\begin{tikzpicture}[
    river/.style = {
      line width=0.5cm,
      cyan!50,
      rounded corners=0.5cm,
      -{Triangle Cap},
    },
    railway line/.style = {
      color=gray,
      line width=0.075cm,
      rounded corners=0.5cm,
    },
    railway/.style = {
      railway line,
      {Latex[length=5mm]}-{Latex[length=5mm]},
    },
    stop/.style = {
      rounded corners=0.1cm, 
      line width=0.05cm,
      fill=white, 
      draw,
      shape=stop,
      anchor=center,
      minimum height=0.2cm,
    },
    stop1/.style = {
      stop,
      minimum width=0.2cm, 
    },
    stop2/.style = {
      stop,
      minimum width=0.4cm, 
    },
    stop3/.style = {
      stop,
      minimum width=0.6cm, 
    },
    stop4/.style = {
      stop,
      minimum width=0.8cm, 
    },
    stop5/.style = {
      stop,
      minimum width=1cm
    },
    stop6/.style = {
      stop,
      minimum width=1.2cm
    },
    stop7/.style = {
      stop,
      minimum width=1.4cm
    },
    stop8/.style = {
      stop,
      minimum width=1.6cm
    },
    stop9/.style = {
      stop,
      minimum width=1.8cm
    },
    stop10/.style = {
      stop,
      minimum width=2.0cm
    },
    line/.style = {
      line width=0.15cm,
      rounded corners=0.1cm,
    },
    occassional/.style = {
      line width=0.075cm,
      rounded corners=0.1cm,
    },
    label/.style = {
      font=\scriptsize,
    },
    line name/.style = {
      label, 
      color=white, 
      minimum width=1em, 
      minimum height=1em, 
      inner sep=0pt,
    },
  ]

  % \begin{pgfonlayer}{legend}
  %   % \draw[railway line] (-7,-8.5) -- ++(0,0.5);
  %   \node[stop2] (Legend2) at (-7,-8.5) {};
  %   \node[stop1, above=0.4cm of Legend2.two half] (Legend1) {};
  %   \node[stop1, above=0.3cm of Legend1] (Legend0) {};
  %   \draw[line] (Legend2.south two half) -- (Legend1.north center) -- (Legend0);
  %   \draw[line] (Legend2.south one half) -- ++(0,0.5) -- ++(-0.3,0);
  %   \node[stop2] (Legend2) at (-7,-8.5) {};
  %   \node[stop1, above=0.4cm of Legend2.two half] (Legend1) {};
  %   \node[stop1, above=0.3cm of Legend1] (Legend0) {};
  %   \node[line name, fill=black, above=0.2cm of Legend0] {\bf E};
  %   \node[label, left=0.05cm of Legend1] {Karlsplatz};
  %   \node[label, left=0.05cm of Legend0] {Museum};
  %   \node[label, left=0.05cm of Legend2] {Bahnhof};
  %
  %   \node[label, anchor=west] at (-6.7,-8.5) {Halt mit Umstieg};
  %   \node[label, anchor=west] at (-6.7,-8.0) {Halt};
  %   \node[label, anchor=west] at (-6.7,-7.5) {Endhaltestelle};
  % \end{pgfonlayer}

  \begin{pgfonlayer}{bg}
    % \draw[help lines, color=gray!10] (-10, -15) grid[step=0.1] (10, 10);
    % \draw[help lines, color=gray!50] (-10, -15) grid (10, 10);
    % \draw[river] (11.7, 2.5) -- (7.7, 2.5) -- (3.7, -1.5) -- (-13, -1.5);
  \end{pgfonlayer}

  \begin{pgfonlayer}{stops}
    % Karlsruhe to Bruchsal
    \node[stop3, rotate=-45] (Karlsruhe Hbf) at (0,-7) {};
    \node[stop1, above right = 1.1cm of Karlsruhe Hbf.two half] (KA-Durlach) {};
    \node[stop1, above right = 1.1cm of KA-Durlach] (Weingarten Baden) {};
    \node[stop1, above right = 1.1cm of Weingarten Baden] (Untergrombach) {};
    \node[stop1, above right = 1.1cm of Untergrombach] (Bruchsal-Bildungszentrum) {};
    \node[stop3] (Bruchsal) at ($(Bruchsal-Bildungszentrum)+(0.6,1.3)$) {};
    \node[stop2, above=1cm of Bruchsal.two half, anchor=two half] (Ubstadt-Weiher) {};

    % Karlsruhe to Graben-Neudorf
    \node[stop1] (KA-Hagsfeld) at ($(Karlsruhe Hbf)+(0.2,1)$) {};
    \node[stop1, above= 1.5cm of KA-Hagsfeld] (Blankenloch) {};
    \node[stop1, above= 1.5cm of Blankenloch] (Friedrichstal Baden) {};

    % Bruchsal to Germersheim
    \node[stop1] (Bruchsal Sportzentrum) at ($(Bruchsal.one half)+(-1.8,0.4)$) {};
    \node[stop1, left=0.5cm of Bruchsal Sportzentrum] (Bruchsal Am Mantel) {};
    \node[stop1, left=0.5cm of Bruchsal Am Mantel] (Karlsdorf) {};
    \node[stop3] (Graben-Neudorf) at ($(Karlsdorf)-(0.95,-0.4)$) {};
    \node[stop1, above=0.5cm of Graben-Neudorf.two half] (Graben-Neudorf Nord) {};
    \node[stop2, above=1.7cm of Graben-Neudorf, anchor=two half] (Wiesental) {};
    \node[stop1] (Huttenheim) at ($(Graben-Neudorf Nord)+(-1,1.3)$) {};
    \node[stop1] (Phillipsburg Baden) at ($(Huttenheim)-(2.1,-0.4)$) {};
    \node[stop1, left=1.7cm of Phillipsburg Baden] (Rheinsheim) {};

    % Bruchsal to Heidelberg
    \def\laststop{Ubstadt-Weiher}
    \foreach\stop in {Stettfeld-Weiher,Bad Schönborn Süd,Bad Schönborn-Kronau,Rot-Malsch,Wiesloch-Walldorf,St Ilgen-Sandhausen,HD-Kirchheim-Rohrbach}{
      \expandafter\node[stop2, above=0.7cm of \laststop] (\stop) {};
      \xdef\laststop{\stop}
    }

    % Graben-Neudorf to Schwetzingen
    \node[stop2, above=0.7cm of Wiesental] (Waghäusel) {};
    \node[stop2, above=0.7cm of Waghäusel] (Neulußheim) {};
    \node[stop3, above=0.7cm of Neulußheim.two half] (Hockenheim) {};
    \node[stop3, above=0.7cm of Hockenheim] (Oftersheim) {};
    \node[stop3, above=0.7cm of Oftersheim] (Schwetzingen) {};

    % Heidelberg to Mannheim Friedrichsfeld
    \node[stop6, rotate=45, anchor=one half] (Heidelberg Hbf) at ($(HD-Kirchheim-Rohrbach)-(0.8,-1)$) {};
    \node[stop5, rotate=45, above left=0.9cm of Heidelberg Hbf.one half, anchor=one half] (HD-Pfaffengrund-Wieblingen) {};
    \node[stop4, rotate=45, above left=0.9cm of HD-Pfaffengrund-Wieblingen.one half, anchor=one half] (MA-Friedrichsfeld Süd) {};
    
    % Schwetzingen to Frankfurt 
    \node[stop2, rotate=-45] (Neu-Edingen Friedrichsfeld) at ($(Schwetzingen)+(3.3,4.4)$) {};

    % Heidelberg to Neckargemünd
    \node[stop3, rotate=90, right=2.2cm of Heidelberg Hbf.three sixth, anchor=two half] (HD-Weststadt Südstadt) {};
    \def\laststop{HD-Weststadt Südstadt}
    \foreach\stop in {HD-Altstadt,HD-Schlierbach Ziegelhausen,HD Orthopädie,Neckargemünd}{
      \expandafter\node[stop3, rotate=90, right=0.9cm of \laststop.center, anchor=center] (\stop) {};
      \xdef\laststop{\stop}
    }

    % Neckargemünd to Aglasterhausen/Eppingen
    \node[stop1] (Bammental) at ($(Neckargemünd)+(0.7,-1)$) {};
    \node[stop1, below=0.7cm of Bammental] (Reilsheim) {};
    \node[stop1, below=0.7cm of Reilsheim] (Mauer bei Heidelberg) {};
    \node[stop1, below=0.7cm of Mauer bei Heidelberg] (Meckesheim) {};
    \node[stop1, below=1cm of Meckesheim] (Zuzenhausen) {};
    \node[stop1, below=0.7cm of Zuzenhausen] (Hoffenheim) {};
    \node[stop1, below=0.7cm of Hoffenheim] (Sinsheim Elsenz Hbf) {};
    \node[stop1] (Eschelbronn) at ($(Meckesheim)+(0.7,-1)$) {};
    \node[stop1, below right=0.7cm of Eschelbronn] (Neidenstein) {};
    \node[stop1] (Waibstadt) at ($(Neidenstein)+(1.7,-0.5)$) {};
    \node[stop1, right=0.7cm of Waibstadt] (Neckarbischofsheim Nord) {};
    \node[stop1, right=0.7cm of Neckarbischofsheim Nord] (Helmstadt) {};
    \node[stop1, right=0.7cm of Helmstadt] (Aglasterhausen) {};
    \node[stop1] (Sinsheim Museum Arena) at ($(Sinsheim Elsenz Hbf)+(0.4,-0.7)$) {};
    \def\laststop{Sinsheim Museum Arena}
    \foreach\stop in {Steinsfurt,Reihen,Ittlingen,Richen, Eppingen}{
      \expandafter\node[stop1, below right=0.7cm of \laststop] (\stop) {};
      \xdef\laststop{\stop}
    }

    % Neckargemünd to Osterburken
    \node[stop2, rotate=90, right=1.4cm of Neckargemünd.one half, anchor=one half] (Neckargemünd Altstadt) {};
    \node[stop2, rotate=-45] (Neckarsteinach) at ($(Neckargemünd Altstadt)+(1.4,0.7)$) {};
    \node[stop2, rotate=-45, above right=0.7cm of Neckarsteinach.one half, anchor=one half] (Neckarhausen) {};
    \node[stop2, rotate=-45, above right=0.7cm of Neckarhausen.one half, anchor=one half] (Hirschhorn) {};
    \node[stop2, rotate=-90] (Eberbach) at ($(Hirschhorn)+(1.1,0.4)$) {};
    \node[stop2, rotate=45] (Lindach) at ($(Eberbach)+(1.1,-0.4)$) {};
    \node[stop2, rotate=45, below right=0.7cm of Lindach.center, anchor=center] (Zwingenberg Baden) {};
    \node[stop2, rotate=45, below right=0.7cm of Zwingenberg Baden.center, anchor=center] (Neckargerach) {};
    \node[stop2, rotate=45, below right=0.7cm of Neckargerach.center, anchor=center] (Binau) {};
    \node[stop2, rotate=45, below right=0.7cm of Binau.center, anchor=center] (Mosbach-Neckarelz) {};
    \node[stop2, rotate=90] (Mosbach West) at ($(Mosbach-Neckarelz)+(1.1,-0.4)$) {};
    \node[stop2, rotate=90, right=0.7cm of Mosbach West.center, anchor=center] (Mosbach Baden) {};
    \node[stop1, right=0.7cm of Mosbach Baden.two half] (Neckarburken) {};
    \node[stop1] (Dallau) at ($(Neckarburken)+(1.2,0.7)$) {};
    \node[stop1, above right=0.7cm of Dallau] (Auerbach) {};
    \node[stop1, above right=0.7cm of Auerbach] (Oberschefflenz) {};
    \node[stop1, above right=0.7cm of Oberschefflenz] (Eichholzheim) {};
    \node[stop1] (Seckach) at ($(Eichholzheim)+(0.7,0.4)$) {};
    \node[stop1, right=0.7cm of Seckach] (Zimmern) {};
    \node[stop1, right=0.7cm of Zimmern] (Adelsheim Nord) {};
    \node[stop1, right=0.7cm of Adelsheim Nord] (Osterburken) {};

    % MA-Seckenheim to Mannheim
    \node[stop5, rotate=45, above left=1.4cm of MA-Friedrichsfeld Süd.one half, anchor=one half] (MA-Seckenheim) {};
    \node[stop5, rotate=45, above left=0.9cm of MA-Seckenheim.one half, anchor=one half] (MA-Arena-Maimarkt) {};
    \node[stop10, rotate=45, above left=1.4cm of MA-Arena-Maimarkt.one half, anchor=three sixth] (Mannheim Hbf) {};

    % Schwetzingen to Mannheim
    \node[stop2, above=1.4cm of Schwetzingen, anchor=two half] (Schwetzingen-Hirschacker) {};
    \node[stop2, above=0.7cm of Schwetzingen-Hirschacker] (MA-Rheinau) {};
    \node[stop2, above=0.7cm of MA-Rheinau] (MA-Neckarau) {};

    % Neu-Edingen/Friedrichsfeld to Bensheim
    \node[stop1, above right=0.7cm of Neu-Edingen Friedrichsfeld.one half] (Ladenburg) {};
    \node[stop1, above right=0.7cm of Ladenburg] (Heddesheim Hirschberg) {};
    \node[stop1, above right=0.7cm of Heddesheim Hirschberg] (Lützelsachsen) {};
    \node[stop1, above right=0.7cm of Lützelsachsen] (Weinheim Hbf) {};
    \node[stop1] (Weinheim-Sulzbach) at ($(Weinheim Hbf)+(0.3,0.7)$) {};
    \node[stop1, above=0.7cm of Weinheim-Sulzbach] (Hemsbach) {};
    \node[stop1, above=0.7cm of Hemsbach] (Laudenbach) {};
    \node[stop1, above=0.7cm of Laudenbach] (Heppenheim) {};
    \node[stop1, above=0.7cm of Heppenheim] (Bensheim) {};

    % Mannheim to Ludwigshafen
    \node[stop5, rotate=90] (LU-Mitte) at ($(Mannheim Hbf)-(2.1,-0.45)$) {};
    \node[stop5, rotate=90, left=1.4cm of LU-Mitte.center, anchor=center] (Ludwigshafen Hbf) {};

    % Mannheim to Groß-Rohrheim
    \node[stop2] (MA-Handelshafen) at ($(Mannheim Hbf.one half)-(0.5,-2.7)$) {};
    \node[stop2, above=0.7cm of MA-Handelshafen] (MA-Neckarstadt) {};
    \node[stop2, above=0.7cm of MA-Neckarstadt] (MA-Luzenberg) {};
    \node[stop3, above=0.8cm of MA-Luzenberg.two half] (MA-Waldhof) {};
    \node[stop1] (MA-Käfertal) at ($(Mannheim Hbf.three quarter)+(0.9,2.5)$) {};
    \node[stop2, above=0.8cm of MA-Waldhof.one half, anchor=one half] (Lampertheim) {};
    \node[stop2, above=0.7cm of Lampertheim] (Bürstadt) {};
    \node[stop2, above=0.7cm of Bürstadt] (Bobstadt) {};
    \node[stop2, above=0.7cm of Bobstadt] (Biblis) {};
    \node[stop1] (Groß-Rohrheim) at ($(Biblis.one half)+(0.7,1)$) {};

    % Ludwigshafen to Mainz
    \node[stop1] (LU-Oggersheim) at ($(Ludwigshafen Hbf.two half)-(1.4,-0.3)$) {};
    \node[stop1, above left=0.7cm of LU-Oggersheim] (Frankenthal Süd) {};
    \def\laststop{Frankenthal Süd}
    \foreach\stop in {Frankenthal Hbf, Bobenheim, Worms Hbf, Osthofen, Mettenheim, Alsheim, Guntersblum, Dienheim, Oppenheim, Nierstein, Nackenheim, Bodenheim, MZ-Laubenheim, Mainz Römisches Theater, Mainz Hbf}{
      \expandafter\node[stop1, above=0.7cm of \laststop] (\stop) {};
      \xdef\laststop{\stop}
    }

    % Ludwigshafen to Schifferstadt
    \node[stop4, rotate=-45] (LU-Mundenheim) at ($(Ludwigshafen Hbf.three quarter)-(1.5,1.1)$) {};
    \node[stop4, rotate=-45, below left=0.7cm of LU-Mundenheim.one half, anchor=one half] (LU-Rheingönheim) {};
    \node[stop4, rotate=-45, below left=0.7cm of LU-Rheingönheim.one half, anchor=one half] (Limburgerhof) {};
    \node[stop4, rotate=-45, below left=0.7cm of Limburgerhof.one half, anchor=one half] (Schifferstadt) {};

    % Schifferstadt to Germersheim
    \node[stop2] (Schifferstadt Süd) at ($(Schifferstadt.two half)-(0.4,0.9)$) {};
    \def\laststop{Schifferstadt Süd}
    \foreach\stop in {Speyer Nord-West, Speyer Hbf, Berghausen, Heiligenstein, Lingenfeld}{
      \expandafter\node[stop2, below=0.7cm of \laststop] (\stop) {};
      \xdef\laststop{\stop}
    }
    \node[stop3, below=0.8cm of Lingenfeld.two half] (Germersheim) {};

    % Germersheim to Karlsruhe
    \node[stop2, rotate=45] (Germersheim Mitte) at ($(Germersheim.one half)+(0.6,-0.9)$) {};
    \node[stop1] (Sondernheim) at ($(Germersheim Mitte.one half)+(0.3,-1.4)$) {};
    \node[stop1, below=1.4cm of Sondernheim] (Bellheim) {};
    \node[stop1, below=1.4cm of Bellheim] (Rülzheim) {};
    \node[stop1] (Rheinzabern) at ($(Rülzheim)+(0.7,-1)$) {};
    \node[stop1, below right=1.4cm of Rheinzabern] (Rheinzabern Alte Römerstraße) {};
    \node[stop1, below right=1.4cm of Rheinzabern Alte Römerstraße] (Jockgrim) {};
    \node[stop1] (Wörth) at ($(Jockgrim)+(1,-0.3)$) {};
    \node[stop1, right=0.6cm of Wörth] (KA-Knielingen) {};

    % Schifferstadt to Homburg
    \node[stop2, rotate=90] (Böhl-Iggelheim) at ($(Schifferstadt.one half)-(0.9,0.4)$) {};
    \def\laststop{Böhl-Iggelheim}
    \foreach\stop in {Haßloch, Neustadt-Böbig, Neustadt Hbf, Lambrecht, Neidenfels, Weidenthal, Frankenstein, Hochspeyer, Kaiserslautern Hbf}{
      \expandafter\node[stop2, rotate=90, left=0.9cm of \laststop.one half, anchor=one half] (\stop) {};
      \xdef\laststop{\stop}
    }
    \node[stop1, left=0.8cm of Kaiserslautern Hbf.two half] (Kennelgarten) {};
    \def\laststop{Kennelgarten}
    \foreach\stop in {Vogelweh, Einsiedlerhof, Kindsbach, Landstuhl, Hauptstuhl, Bruchmühlbach-Miesau, Homburg Hbf}{
      \expandafter\node[stop1, left=0.7cm of \laststop] (\stop) {};
      \xdef\laststop{\stop}
    }
  \end{pgfonlayer}

  \begin{pgfonlayer}{lines}
    \pgfmathparse{0.1*tan(45/2)}
    \let\offset\pgfmathresult

    \draw[occassional, five] (Heidelberg Hbf.two half)
      -- (Mannheim Hbf.four sixth)
      -- ++(-0.3,0.3)
      -- ++(-0.3,0)
    ;

    \draw[occassional, seven] (Hockenheim.two half)
      -- (Oftersheim.two half)
      -- (Schwetzingen.two half)
      -- ++(0,1.1)
      -- (Neu-Edingen Friedrichsfeld.two half)
      -- ++(-0.4,-0.4)
      -- ++(0,-0.8)
      -- (HD-Pfaffengrund-Wieblingen.two half)
      -- (Heidelberg Hbf.three quarter)
    ;

    \draw[occassional, eight] (Mannheim Hbf.three quarter)
      -- ++(0.7,-0.7)
      -- ++(0.7,0.7)
      -- ++(0,2)
      -- (MA-Käfertal)
      -- ++(-1.2,1.2)
      -| (MA-Waldhof.two half)
      -- ++(0,0.3)
      -- ++(-0.2,0.2)
      -- (Lampertheim.two half)
      -- (Bürstadt.two half)
      -- (Bobstadt.two half)
      -- (Biblis.two half)
    ;

    \draw[occassional, thirty-nine] (Mannheim Hbf.two half)
      {[rounded corners=0.8cm]
        -- ++(-0.75,0.75)
      }
      -| (MA-Handelshafen.two half)
      -- (MA-Neckarstadt.two half)
      -- (MA-Luzenberg.two half)
      -- (MA-Waldhof)
    ;

    \draw[line, one] (Homburg Hbf)
      -- (Bruchmühlbach-Miesau)
      -- (Hauptstuhl)
      -- (Landstuhl)
      -- (Kindsbach)
      -- (Einsiedlerhof)
      -- (Vogelweh)
      -- (Kennelgarten)
      -- (Kaiserslautern Hbf.two half)
      -- (Hochspeyer.two half)
      -- (Frankenstein.two half)
      -- (Weidenthal.two half)
      -- (Neidenfels.two half)
      -- (Lambrecht.two half)
      -- (Neustadt Hbf.two half)
      -- (Neustadt-Böbig.two half)
      -- (Haßloch.two half)
      -- (Böhl-Iggelheim.two half)
      -- ($(Böhl-Iggelheim.two half)+(0.6,0)$)
      -- (Schifferstadt.one half)
      -- (Limburgerhof.one half)
      -- (LU-Rheingönheim.one half)
      -- (LU-Mundenheim.one half)
      {[rounded corners=0.4cm]
      -- ($(Ludwigshafen Hbf.three quarter)-(0.6,0)-(6*\offset,0)$)
      -- (Ludwigshafen Hbf.three quarter)
      -- (LU-Mitte.three quarter)
      -- ($(LU-Mitte.three quarter)+(1.3,0)+(6*\offset,0)$)      }
      -- (Mannheim Hbf.six tenth)
      -- (MA-Arena-Maimarkt.three quarter)
      -- (MA-Seckenheim.three quarter)
      -- (MA-Friedrichsfeld Süd.two half)
      -- (HD-Pfaffengrund-Wieblingen.three quarter)
      -- (Heidelberg Hbf.four sixth)
      -- ($(HD-Weststadt Südstadt)-(1.7,0)$)
      -- (HD-Weststadt Südstadt)
      -- (HD-Altstadt)
      -- (HD-Schlierbach Ziegelhausen)
      -- (HD Orthopädie)
      -- (Neckargemünd)
      -- (Neckargemünd Altstadt.two half)
      -- ++($(0.7,0)-(\offset,0)$)
      -- (Neckarsteinach.one half)
      -- (Neckarhausen.one half)
      -- (Hirschhorn.one half)
      {[rounded corners=0.2cm]
        -- ($(Eberbach.one half)-(0.7,0)-(\offset,0)$)
        -- (Eberbach.one half)
        -- ($(Eberbach.one half)+(0.7,0)+(\offset,0)$)
      }
      -- (Lindach.two half)
      -- (Zwingenberg Baden.two half)
      -- (Neckargerach.two half)
      -- (Binau.two half)
      -- (Mosbach-Neckarelz.two half)
      -- ($(Mosbach West.two half)-(0.7,0)+(\offset,0)$)
      -- (Mosbach West.two half)
      -- (Mosbach Baden.two half)
      -- (Neckarburken)
      -- ++(0.5,0)
      -- (Dallau)
      -- (Auerbach)
      -- (Oberschefflenz)
      -- (Eichholzheim)
      -- ++(0.4,0.4)
      -- (Seckach)
      -- (Zimmern)
      -- (Adelsheim Nord)
      -- (Osterburken)
      ;

    \draw[line, two] (Kaiserslautern Hbf.one half)
      -- (Hochspeyer.one half)
      -- (Frankenstein.one half)
      -- (Weidenthal.one half)
      -- (Neidenfels.one half)
      -- (Lambrecht.one half)
      -- (Neustadt Hbf.one half)
      -- (Neustadt-Böbig.one half)
      -- (Haßloch.one half)
      -- (Böhl-Iggelheim.one half)
      {[rounded corners=0.2cm]
      -- ($(Böhl-Iggelheim.one half)+(0.6,0)+(2*\offset,0)$)
      }
      -- (Schifferstadt.two quarter)
      -- (Limburgerhof.two quarter)
      -- (LU-Rheingönheim.two quarter)
      -- (LU-Mundenheim.two quarter)
      {[rounded corners=0.3cm]  
      -- ($(Ludwigshafen Hbf)-(0.6,0)-(4*\offset,0)$)
      -- (Ludwigshafen Hbf)
      -- (LU-Mitte)
      -- ($(LU-Mitte)+(1.3,0)+(4*\offset,0)$)
      }
      -- (Mannheim Hbf.five tenth)
      -- (MA-Arena-Maimarkt)
      -- (MA-Seckenheim)
      -- (MA-Friedrichsfeld Süd.three quarter)
      -- (HD-Pfaffengrund-Wieblingen)
      {[rounded corners=0.2cm]
        -- (Heidelberg Hbf.three sixth)
        -- ($(HD-Weststadt Südstadt.one half)-(1.7,0)-(2*\offset,0)$)
      }
      -- (HD-Weststadt Südstadt.one half)
      -- (HD-Altstadt.one half)
      -- (HD-Schlierbach Ziegelhausen.one half)
      -- (HD Orthopädie.one half)
      -- (Neckargemünd.one half)
      -- (Neckargemünd Altstadt.one half)
      {[rounded corners=0.2cm]
        -- ++($(0.7,0)+(\offset,0)$)
      }
      -- (Neckarsteinach.two half)
      -- (Neckarhausen.two half)
      -- (Hirschhorn.two half)
      -- ($(Eberbach.two half)-(0.7,0)+(\offset,0)$)
      -- (Eberbach.two half)
      -- ($(Eberbach.two half)+(0.7,0)-(\offset,0)$)
      -- (Lindach.one half)
      -- (Zwingenberg Baden.one half)
      -- (Neckargerach.one half)
      -- (Binau.one half)
      -- (Mosbach-Neckarelz.one half)
      {[rounded corners=0.2cm]
        -- ($(Mosbach West.one half)-(0.7,0)-(\offset,0)$)
        -- (Mosbach West.one half)
        -- (Mosbach Baden.one half)
      }
    ;
      
    \draw[line, three] (Karlsruhe Hbf.two half)
      -- (KA-Durlach)
      -- (Weingarten Baden)
      -- (Untergrombach)
      -- (Bruchsal-Bildungszentrum)
      -- ++(0.6,0.6)
      -- (Bruchsal)
      -- (Ubstadt-Weiher.one half)
      -- (Stettfeld-Weiher.one half)
      -- (Bad Schönborn Süd.one half)
      -- (Bad Schönborn-Kronau.one half)
      -- (Rot-Malsch.one half)
      -- (Wiesloch-Walldorf.one half)
      -- (St Ilgen-Sandhausen.one half)
      -- (HD-Kirchheim-Rohrbach.one half)
      -- ++(0,0.3)
      -- (Heidelberg Hbf.one half)
      -- (HD-Pfaffengrund-Wieblingen.one half)
      -- (MA-Friedrichsfeld Süd.one half)
      -- (MA-Seckenheim.one half)
      -- (MA-Arena-Maimarkt.one half)
      -- (Mannheim Hbf.three sixth)
      -- ($(LU-Mitte.one half)+(1.3,0)$)
      -- (LU-Mitte.one half)
      -- (Ludwigshafen Hbf.one half)
      -- ($(Ludwigshafen Hbf.one half)-(0.6,0)$)
      -- (LU-Mundenheim.two half)
      -- (LU-Rheingönheim.two half)
      -- (Limburgerhof.two half)
      -- (Schifferstadt.two half)
      -- ($(Schifferstadt Süd.two half)+(0,0.6)$)
      -- (Schifferstadt Süd.two half)
      -- (Speyer Nord-West.two half)
      -- (Speyer Hbf.two half)
      -- (Berghausen.two half)
      -- (Heiligenstein.two half)
      -- (Lingenfeld.two half)
      -- (Germersheim)
      {[rounded corners=0.2cm]
      -- ($(Germersheim)-(0,0.5)-(0,2*\offset)$)
      }
      -- (Germersheim Mitte.one half)
      -- ++(0.3,-0.3)
      -- (Sondernheim)
      -- (Bellheim)
      -- (Rülzheim)
      -- ++(0,-0.3)
      -- (Rheinzabern)
      -- (Rheinzabern Alte Römerstraße)
      -- (Jockgrim)
      -- ++(0.3,-0.3)
      -- (Wörth)
      -- (KA-Knielingen)
      -- ++(0.25,0)
      -- (Karlsruhe Hbf.one half)
    ;

    \draw[line, four] (Bruchsal.two half)
      -- (Ubstadt-Weiher.two half)
      -- (Stettfeld-Weiher.two half)
      -- (Bad Schönborn Süd.two half)
      -- (Bad Schönborn-Kronau.two half)
      -- (Rot-Malsch.two half)
      -- (Wiesloch-Walldorf.two half)
      -- (St Ilgen-Sandhausen.two half)
      -- (HD-Kirchheim-Rohrbach.two half)
      {[rounded corners=0.2cm]
      -- ++($(0,0.3)+(0,2*\offset)$)
      }
      -- (Heidelberg Hbf.two quarter)
      -- (HD-Pfaffengrund-Wieblingen.two quarter)
      -- (MA-Friedrichsfeld Süd.two quarter)
      -- (MA-Seckenheim.two quarter)
      -- (MA-Arena-Maimarkt.two quarter)
      -- (Mannheim Hbf.four eighth)
      {[rounded corners=0.2cm]
      -- ($(LU-Mitte.two quarter)+(1.3,0)+(2*\offset,0)$)
      -- (LU-Mitte.two quarter)
      -- (Ludwigshafen Hbf.two quarter)
      -- ($(Ludwigshafen Hbf.two quarter)-(0.6,0)-(2*\offset,0)$)
      -- (LU-Mundenheim.three quarter)
      -- (LU-Rheingönheim.three quarter)
      -- (Limburgerhof.three quarter)
      -- (Schifferstadt.three quarter)
      -- ($(Schifferstadt Süd.one half)+(0,0.6)+(0,2*\offset)$)
      -- (Schifferstadt Süd.one half)
      }
      -- (Speyer Nord-West.one half)
      -- (Speyer Hbf.one half)
      -- (Berghausen.one half)
      -- (Heiligenstein.one half)
      -- (Lingenfeld.one half)
      -- (Germersheim.one half)
    ;

    \draw[line,five] (Heidelberg Hbf.two half)
      -- ($(HD-Weststadt Südstadt.two half)-(1.3,0)$)
      -- (HD-Weststadt Südstadt.two half)
      -- (HD-Altstadt.two half)
      -- (HD-Schlierbach Ziegelhausen.two half)
      -- (HD Orthopädie.two half)
      -- (Neckargemünd.two half)
      {[rounded corners=0.3cm]
      -| (Bammental)
      }
      -- (Reilsheim)
      -- (Mauer bei Heidelberg)
      -- (Meckesheim)
      -- (Zuzenhausen)
      -- (Hoffenheim)
      -- (Sinsheim Elsenz Hbf)
      -- ++(0.0,-0.3)
      -- (Sinsheim Museum Arena)
      -- (Steinsfurt)
      -- (Reihen)
      -- (Ittlingen)
      -- (Richen)
      -- (Eppingen)
    ;

    \draw[line, five] (Meckesheim)
      -- ++(0,-0.3)
      -- (Eschelbronn)
      -- (Neidenstein)
      -- ++(0.5,-0.5)
      -- (Waibstadt)
      -- (Neckarbischofsheim Nord)
      -- (Helmstadt)
      -- (Aglasterhausen)
    ;

    \draw[line, six] (Mainz Hbf)
      -- (Mainz Römisches Theater)
      -- (MZ-Laubenheim)
      -- (Bodenheim)
      -- (Nackenheim)
      -- (Nierstein)
      -- (Oppenheim)
      -- (Dienheim)
      -- (Guntersblum)
      -- (Alsheim)
      -- (Mettenheim)
      -- (Osthofen)
      -- (Worms Hbf)
      -- (Bobenheim)
      -- (Frankenthal Hbf)
      -- (Frankenthal Süd)
      {[rounded corners=0.2cm]
        |- (LU-Oggersheim)
      }
      -- ++(0.3,0)
      -- ++(0.3,-0.3)
      -- (Ludwigshafen Hbf.two half)
      -- (LU-Mitte.two half)
      {[rounded corners=0.5cm]
      -- ($(LU-Mitte.two half)+(1.3,0)+(8*\offset,0)$)
      }
      -- (Mannheim Hbf.five eighth)
      -- (MA-Arena-Maimarkt.two half)
      -- (MA-Seckenheim.two half)
      {[rounded corners=0.4cm]
        -- ++(0.45,-0.45)
      }
      -- (Neu-Edingen Friedrichsfeld.one half)
      -- (Ladenburg)
      -- (Heddesheim Hirschberg)
      -- (Lützelsachsen)
      -- (Weinheim Hbf)
      -- ++(0.3,0.3)
      -- (Weinheim-Sulzbach)
      -- (Hemsbach)
      -- (Laudenbach)
      -- (Heppenheim)
      -- (Bensheim)
    ;

    \draw[line, nine] (Karlsruhe Hbf)
      -- ($(Karlsruhe Hbf)+(0.2,0.2)$)
      -- (KA-Hagsfeld)
      -- (Blankenloch)
      -- (Friedrichstal Baden)
      -- (Graben-Neudorf)
      -- (Wiesental.two half)
      -- (Waghäusel.two half)
      -- (Neulußheim.two half)
      -- (Hockenheim)
      -- (Oftersheim)
      -- (Schwetzingen)
      -- (Schwetzingen-Hirschacker.two half)
      -- (MA-Rheinau.two half)
      -- (MA-Neckarau.two half)
      {[rounded corners=0.2cm]
        -- ($(MA-Neckarau.two half)+(0,1.3)+(0,2*\offset)$)
      }
      -- (Mannheim Hbf.two quarter)
    ;

    \draw[line, nine] (Graben-Neudorf.one half)
      -- (Wiesental.one half)
      -- (Waghäusel.one half)
      -- (Neulußheim.one half)
      -- (Hockenheim.one half)
      -- (Oftersheim.one half)
      -- (Schwetzingen.one half)
      -- (Schwetzingen-Hirschacker.one half)
      -- (MA-Rheinau.one half)
      -- (MA-Neckarau.one half)
      -- ($(MA-Neckarau.one half)+(0,1.3)$)
      -- (Mannheim Hbf.one half)
      -- ++(-0.6,0.6)
      -- (MA-Handelshafen.one half)
      -- (MA-Neckarstadt.one half)
      -- (MA-Luzenberg.one half)
      -- (MA-Waldhof.one half)
      -- (Lampertheim.one half)
      -- (Bürstadt.one half)
      -- (Bobstadt.one half)
      -- (Biblis.one half)
      -- ++(0,0.3)
      -- (Groß-Rohrheim)
    ;

    \draw[line, thirty-three] (Bruchsal.one half)
      {[rounded corners=0.2cm]
      |- (Bruchsal Sportzentrum)
      }
      -- (Bruchsal Am Mantel)
      -- (Karlsdorf)
      {[rounded corners=0.2cm]
      -| (Graben-Neudorf.two half)
      }
      -- (Graben-Neudorf Nord)
      -- ++(0,0.3)
      -- (Huttenheim)
      -- ++(-0.4,0.4)
      -- (Phillipsburg Baden)
      -- (Rheinsheim)
      -- ($(Germersheim Mitte.two half)+(0.17,-0.17)$)
      -- (Germersheim Mitte.two half)
      -- ($(Germersheim.two half)-(0,0.5)$)
      -- (Germersheim.two half)
    ;
    
  \end{pgfonlayer}

  \begin{pgfonlayer}{labels}
    \node[font=\scriptsize, color=white] at (4.0,1.5){Neckar};
    \node[font=\scriptsize, color=white, rotate=-45] at (-3.5,3.5) {Neckar};
    \foreach\stop/\placement/\anchor/\rotate in {
      Karlsruhe Hbf/left/east/0,
      KA-Durlach/right/west/0,
      Weingarten Baden/right/west/0,
      KA-Hagsfeld/left/east/0,
      Blankenloch/left/east/0,
      Untergrombach/right/west/0,
      Bruchsal-Bildungszentrum/right/west/0,
      Bruchsal/right/west/0,
      Bruchsal Sportzentrum/above/west/45,
      Bruchsal Am Mantel/above/west/45,
      Karlsdorf/above/west/45,
      Ubstadt-Weiher/right/west/0,
      Friedrichstal Baden/left/east/0,
      Graben-Neudorf/left/east/0,
      Graben-Neudorf Nord/right/west/45,
      Huttenheim/left/east/0,
      Wiesental/right/west/45,
      Phillipsburg Baden/above/west/45,
      Rheinsheim/above/west/45,
      Stettfeld-Weiher/right/west/0,
      Bad Schönborn Süd/right/west/0,
      Bad Schönborn-Kronau/right/west/0,
      Rot-Malsch/right/west/0,
      Wiesloch-Walldorf/right/west/0,
      St Ilgen-Sandhausen/right/west/0,
      HD-Kirchheim-Rohrbach/right/west/0,
      Waghäusel/right/west/45,
      Neulußheim/right/west/45,
      Hockenheim/right/west/45,
      Oftersheim/left/east/0,
      Schwetzingen/left/east/0,
      Heidelberg Hbf/left/east/45,
      HD-Pfaffengrund-Wieblingen/left/east/45,
      MA-Friedrichsfeld Süd/left/east/45,
      Neu-Edingen Friedrichsfeld/right/west/0,
      HD-Weststadt Südstadt/right/west/45,
      HD-Altstadt/right/west/45,
      HD-Schlierbach Ziegelhausen/right/west/45,
      HD Orthopädie/right/west/45,
      Neckargemünd/right/west/45,
      Bammental/right/west/0,
      Reilsheim/right/west/0,
      Mauer bei Heidelberg/right/west/0,
      Meckesheim/right/west/0,
      Eschelbronn/right/west/0,
      Neidenstein/right/west/0,
      Zuzenhausen/left/east/0,
      Hoffenheim/left/east/0,
      Sinsheim Elsenz Hbf/left/east/0,
      Waibstadt/above/west/45,
      Neckarbischofsheim Nord/above/west/45,
      Helmstadt/above/west/45,
      Aglasterhausen/above/west/45,
      Sinsheim Museum Arena/left/east/0,
      Steinsfurt/left/east/0,
      Reihen/left/east/0,
      Ittlingen/left/east/0,
      Richen/left/east/0,
      Eppingen/left/east/0,
      Neckargemünd Altstadt/right/west/45,
      Neckarsteinach/right/west/0,
      Neckarhausen/right/west/0,
      Hirschhorn/right/west/0,
      Eberbach/left/west/45,
      Lindach/right/west/45,
      Zwingenberg Baden/right/west/45,
      Neckargerach/right/west/45,
      Binau/right/west/45,
      Mosbach-Neckarelz/right/west/45,
      Mosbach West/right/west/45,
      Mosbach Baden/right/west/45,
      Neckarburken/above/west/45,
      Dallau/right/west/0,
      Auerbach/right/west/0,
      Oberschefflenz/right/west/0,
      Eichholzheim/right/west/0,
      Seckach/above/west/45,
      Zimmern/above/west/45,
      Adelsheim Nord/above/west/45,
      Osterburken/above/west/45,
      MA-Seckenheim/right/west/45,
      MA-Arena-Maimarkt/right/west/45,
      Mannheim Hbf/left/east/45,
      Schwetzingen-Hirschacker/left/east/0,
      MA-Rheinau/left/east/0,
      MA-Neckarau/left/east/0,
      Ladenburg/right/west/0,
      Heddesheim Hirschberg/right/west/0,
      Lützelsachsen/right/west/0,
      Weinheim Hbf/right/west/0,
      Weinheim-Sulzbach/right/west/0,
      Hemsbach/right/west/0,
      Laudenbach/right/west/0,
      Heppenheim/right/west/0,
      Bensheim/right/west/0,
      LU-Mitte/right/south/0,
      Ludwigshafen Hbf/left/east/45,
      MA-Handelshafen/left/east/0,
      MA-Neckarstadt/left/east/0,
      MA-Luzenberg/left/east/0,
      MA-Waldhof/left/east/0,
      MA-Käfertal/right/west/0,
      Lampertheim/left/east/0,
      Bürstadt/left/east/0,
      Bobstadt/left/east/0,
      Biblis/left/east/0,
      Groß-Rohrheim/left/east/0,
      LU-Oggersheim/above/west/45,
      Frankenthal Süd/left/east/0,
      Frankenthal Hbf/left/east/0,
      Bobenheim/left/east/0,
      Worms Hbf/left/east/0,
      Osthofen/left/east/0,
      Mettenheim/left/east/0,
      Alsheim/left/east/0,
      Guntersblum/left/east/0,
      Dienheim/left/east/0,
      Oppenheim/left/east/0,
      Nierstein/left/east/0,
      Nackenheim/left/east/0,
      Bodenheim/left/east/0,
      MZ-Laubenheim/left/east/0,
      Mainz Römisches Theater/left/east/0,
      Mainz Hbf/left/east/0,
      LU-Mundenheim/left/east/0,
      LU-Rheingönheim/left/east/0,
      Limburgerhof/left/east/0,
      Schifferstadt/right/west/0,
      Schifferstadt Süd/right/west/0,
      Speyer Nord-West/left/east/0,
      Speyer Hbf/left/east/0,
      Berghausen/left/east/0,
      Heiligenstein/left/east/0,
      Lingenfeld/left/east/0,
      Germersheim/left/east/0,
      Germersheim Mitte/left/east/0,
      Sondernheim/left/east/0,
      Bellheim/left/east/0,
      Rülzheim/left/east/0,
      Rheinzabern/left/east/0,
      Rheinzabern Alte Römerstraße/left/east/0,
      Jockgrim/left/east/0,
      Wörth/below/east/45,
      KA-Knielingen/below/east/45,
      Böhl-Iggelheim/left/east/45,
      Haßloch/left/east/45,
      Neustadt-Böbig/left/east/45,
      Neustadt Hbf/left/east/45,
      Lambrecht/left/east/45,
      Neidenfels/left/east/45,
      Weidenthal/left/east/45,
      Frankenstein/left/east/45,
      Hochspeyer/left/east/45,
      Kaiserslautern Hbf/left/east/45,
      Kennelgarten/below/east/45,
      Vogelweh/below/east/45,
      Einsiedlerhof/below/east/45,
      Kindsbach/below/east/45,
      Landstuhl/below/east/45,
      Hauptstuhl/below/east/45,
      Bruchmühlbach-Miesau/below/east/45,
      Homburg Hbf/below/east/45%
    } \node[label, \placement=0.05cm of \stop, rotate=\rotate, anchor=\anchor] {\contour{white}{\stop}};
    \node[line name, fill=three, right=0.2cm of Karlsruhe Hbf] (S3-KA) {\bf S3};
    \node[line name, fill=nine, right=0.05cm of S3-KA] {\bf S9};
    \node[line name, fill=four, left=0.2cm of Bruchsal] (S4-RBR) {\bf S4};
    \node[line name, fill=thirty-three, left=0.05cm of S4-RBR] {\bf S33};
    \node[line name, fill=nine, below left =0.2cm of Graben-Neudorf.one half] {\bf S9};
    \node[line name, fill=seven, left=0.2cm of Hockenheim] {\bf S7};
    \node[line name, fill=five, right=0.2cm of Heidelberg Hbf] (S5-HD) {\bf S5};
    \node[line name, fill=five, right=0.05cm of S5-HD] (S51-HD) {\bf S51};
    \node[line name, fill=seven, right=0.05cm of S51-HD] {\bf S7};
    \node[line name, fill=five, right=0.2cm of Aglasterhausen] {\bf S51};
    \node[line name, fill=five, right=0.2cm of Eppingen] {\bf S5};
    \node[line name, fill=two] at ($(Mosbach Baden.one half)-(0,0.4)$) {\bf S2};
    \node[line name, fill=one, right=0.2cm of Osterburken] {\bf S1};
    \node[line name, fill=six, left=0.2cm of Bensheim] {\bf S6};
    \node[line name, fill=nine, right=0.2 cm of Mannheim Hbf.east] (MA-S9) {\bf S9};
    \node[line name, fill=eight, right=0.05cm of MA-S9] {\bf S8};
    \node[line name, fill=thirty-nine, above=0.05cm of MA-S9] {\bf S39};
    \node[line name, fill=thirty-nine, right=0.2cm of MA-Waldhof] {\bf S39};
    \node[line name, fill=eight, right=0.2cm of Biblis] {\bf S8};
    \node[line name, fill=nine, right=0.2cm of Groß-Rohrheim] {\bf S9};
    \node[line name, fill=six, right=0.2cm of Mainz Hbf] {\bf S6};
    \node[line name, fill=four, right=0.2cm of Germersheim] (G-S4) {\bf S4};
    \node[line name, fill=thirty-three, right=0.05cm of G-S4] {\bf S33};
    \node[line name, fill=two, above=0.2cm of Kaiserslautern Hbf.east] {\bf S2};
    \node[line name, fill=one, above=0.2cm of Homburg Hbf] {\bf S1};

  \end{pgfonlayer}

\end{tikzpicture}

\end{document}
% vim: nospell conceallevel=0
