public static PlanetilerConfig from(Arguments arguments) {
    // use --madvise and --storage options as default for temp storage, but allow users to override them explicitly for
    // multipolygon geometries or node locations
    boolean defaultMadvise =
      arguments.getBoolean("madvise",
        "default value for whether to use linux madvise(random) to improve memory-mapped read performance for temporary storage",
        true);
    // nodemap_storage was previously the only option, so if that's set make it the default
    String fallbackTempStorage = arguments.getArg("nodemap_storage", Storage.MMAP.id());
    String defaultTempStorage = arguments.getString("storage",
      "default storage type for temporary data, one of " + Stream.of(Storage.values()).map(
        Storage::id).toList(),
      fallbackTempStorage);
    int threads = arguments.threads();
    int featureWriteThreads =
      arguments.getInteger("write_threads", "number of threads to use when writing temp features",
        // defaults: <48 cpus=1 writer, 48-80=2 writers, 80-112=3 writers, 112-144=4 writers, ...
        Math.max(1, (threads - 16) / 32 + 1));
    int featureProcessThreads =
      arguments.getInteger("process_threads", "number of threads to use when processing input features",
        Math.max(threads < 8 ? threads : (threads - featureWriteThreads), 1));
    Bounds bounds = new Bounds(arguments.bounds("bounds", "bounds"));
    Path polygonFile =
      arguments.file("polygon", "a .poly file that limits output to tiles intersecting the shape", null);
    if (polygonFile != null) {
      try {
        bounds.setShape(PolyFileReader.parsePolyFile(polygonFile));
      } catch (IOException e) {
        throw new UncheckedIOException(e);
      }
    }

    int minzoom = arguments.getInteger("minzoom", "minimum zoom level", MIN_MINZOOM);
    int maxzoom = arguments.getInteger("maxzoom", "maximum zoom level up to " + MAX_MAXZOOM, DEFAULT_MAXZOOM);
    int renderMaxzoom =
      arguments.getInteger("render_maxzoom", "maximum rendering zoom level up to " + MAX_MAXZOOM,
        Math.max(maxzoom, DEFAULT_MAXZOOM));
    Path tmpDir = arguments.file("tmpdir|tmp", "temp directory", Path.of("data", "tmp"));
    List<String> extraNameTags = arguments.getList("extra_name_tags", "Extra name tags to copy from OSM to output",
      List.of());

    return new PlanetilerConfig(
      arguments,
      bounds,
      threads,
      featureWriteThreads,
      featureProcessThreads,
      arguments.getInteger("feature_read_threads", "number of threads to use when reading features at tile write time",
        threads < 32 ? 1 : 2),
      arguments.getInteger("tile_write_threads",
        "number of threads used to write tiles - only supported by " + Stream.of(TileArchiveConfig.Format.values())
          .filter(TileArchiveConfig.Format::supportsConcurrentWrites).map(TileArchiveConfig.Format::id).toList(),
        1),
      arguments.getDuration("loginterval", "time between logs", "10s"),
      minzoom,
      maxzoom,
      renderMaxzoom,
      arguments.getBoolean("force", "overwriting output file and ignore disk/RAM warnings", false),
      arguments.getBoolean("append",
        "append to the output file - only supported by " + Stream.of(TileArchiveConfig.Format.values())
          .filter(TileArchiveConfig.Format::supportsAppend).map(TileArchiveConfig.Format::id).toList(),
        false),
      arguments.getBoolean("compress_temp|gzip_temp",
        "compress temporary feature storage (uses more CPU, but less disk space)", false),
      arguments.getBoolean("mmap_temp", "use memory-mapped IO for temp feature files", true),
      arguments.getInteger("sort_max_readers", "maximum number of concurrent read threads to use when sorting chunks",
        6),
      arguments.getInteger("sort_max_writers", "maximum number of concurrent write threads to use when sorting chunks",
        6),
      arguments
        .getString("nodemap_type", "type of node location map, one of " + Stream.of(LongLongMap.Type.values()).map(
          t -> t.id()).toList(), LongLongMap.Type.SPARSE_ARRAY.id()),
      arguments.getString("nodemap_storage", "storage for node location map, one of " + Stream.of(Storage.values()).map(
        Storage::id).toList(), defaultTempStorage),
      arguments.getBoolean("nodemap_madvise", "use linux madvise(random) for node locations", defaultMadvise),
      arguments.getString("multipolygon_geometry_storage",
        "storage for multipolygon geometries, one of " + Stream.of(Storage.values()).map(Storage::id).toList(),
        defaultTempStorage),
      arguments.getBoolean("multipolygon_geometry_madvise",
        "use linux madvise(random) for temporary multipolygon geometry storage", defaultMadvise),
      arguments.getString("http_user_agent", "User-Agent header to set when downloading files over HTTP",
        "Planetiler downloader (https://github.com/onthegomap/planetiler)"),
      arguments.getDuration("http_timeout", "Timeout to use when downloading files over HTTP", "30s"),
      arguments.getInteger("http_retries", "Retries to use when downloading files over HTTP", 1),
      arguments.getDuration("http_retry_wait", "How long to wait before retrying HTTP request", "5s"),
      arguments.getLong("download_chunk_size_mb", "Size of file chunks to download in parallel in megabytes", 100),
      arguments.getInteger("download_threads", "Number of parallel threads to use when downloading each file", 1),
      Parse.bandwidth(arguments.getString("download_max_bandwidth",
        "Maximum bandwidth to consume when downloading files in units mb/s, mbps, kbps, etc.", "")),
      arguments.getDouble("min_feature_size_at_max_zoom",
        "Default value for the minimum size in tile pixels of features to emit at the maximum zoom level to allow for overzooming",
        256d / 4096),
      arguments.getDouble("min_feature_size",
        "Default value for the minimum size in tile pixels of features to emit below the maximum zoom level",
        1),
      arguments.getDouble("simplify_tolerance_at_max_zoom",
        "Default value for the tile pixel tolerance to use when simplifying features at the maximum zoom level to allow for overzooming",
        256d / 4096),
      arguments.getDouble("simplify_tolerance",
        "Default value for the tile pixel tolerance to use when simplifying features below the maximum zoom level",
        0.1d),
      arguments.getBoolean("osm_lazy_reads",
        "Read OSM blocks from disk in worker threads",
        true),
      arguments.getBoolean("skip_filled_tiles",
        "Skip writing tiles containing only polygon fills to the output",
        false),
      (int) (arguments.getDouble("tile_warning_size_mb",
        "Maximum size in megabytes of a tile to emit a warning about",
        1d) * 1024 * 1024),
      arguments.getBooleanObject("color", "Color the terminal output"),
      arguments.getBoolean("keep_unzipped",
        "keep unzipped sources by default after reading", false),
      TileCompression
        .fromId(arguments.getString("tile_compression",
          "the tile compression, one of " +
            TileCompression.availableValues().stream().map(TileCompression::id).toList(),
          "gzip")),
      arguments.getBoolean("output_layerstats", "output a tsv.gz file for each tile/layer size", false),
      arguments.getString("debug_url", "debug url to use for displaying tiles with {z} {lat} {lon} placeholders",
        "https://onthegomap.github.io/planetiler-demo/#{z}/{lat}/{lon}"),
      tmpDir,
      arguments.file("tile_weights", "tsv.gz file with columns z,x,y,loads to generate weighted average tile size stat",
        tmpDir.resolveSibling("tile_weights.tsv.gz")),
      arguments.getDouble("max_point_buffer",
        "Additional global limit for the max tile pixels to include points outside tile bounds of all layers. Set to a lower value to reduce tile size for " +
          "clients that handle label collisions across tiles (most web and native clients). NOTE: Do not reduce if you need to support " +
          "raster tile rendering",
        Double.POSITIVE_INFINITY),
      arguments.getBoolean("log_jts_exceptions", "Emit verbose details to debug JTS geometry errors", false),
      arguments.getInteger("feature_source_id_multiplier",
        "Set vector tile feature IDs to (featureId * thisValue) + sourceId " +
          "where sourceId is 1 for OSM nodes, 2 for ways, 3 for relations, and 0 for other sources. Set to false to disable.",
        10),
      extraNameTags
    );
  }
Holder for common parameters used by many components in planetiler.
planetiler-core/src/main/java/com/onthegomap/planetiler/config/PlanetilerConfig.java