public static int wayzorder(Map<String, Object> tags) {
    long z = Parse.parseLong(tags.get("layer")) * 10 +
      defaultRank.getOrDefault(
        string(tags.get("highway")),
        tags.containsKey("railway") ? 7 : 0
      ) +
      (boolInt(tags.get("tunnel")) * -10L) +
      (boolInt(tags.get("bridge")) * 10L);
    return Math.abs(z) < 10_000 ? (int) z : 0;
  }
Returns a z-order for an OSM road based on the tags that are present. Bridges are above roads appear above tunnels
and major roads appear above minor.
planetiler-core/src/main/java/com/onthegomap/planetiler/util/Imposm3Parsers.java