private static int doubleRangeToInt(double value, double min, double max, int levels) {
    return Math.min(levels - 1, (int) Math.floor(((value - min) / (max - min)) * levels));
  }
Breaks the input range {@code [min, max]} into {@code levels} discrete levels, and returns an integer corresponding
to the level for {@code value}.
planetiler-core/src/main/java/com/onthegomap/planetiler/util/SortKey.java