Skip to content

CLI Reference

Text below is a captured --help command output.

                                                                                                                                                                                                                                                
 Usage: QuackOSM [OPTIONS] [PBF file path]                                                                                                                                                                                                      
                                                                                                                                                                                                                                                
 QuackOSM CLI.                                                                                                                                                                                                                                  

 Wraps convert_pbf_to_parquet, convert_geometry_to_parquet and convert_osm_extract_to_parquet                                                                                                                                                   
 functions and prints final path to the saved geoparquet file at the end.                                                                                                                                                                       

╭─ Arguments ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
   pbf_file      [PBF file path]  PBF file to convert into GeoParquet. Can be an URL.                                                                                                                                                         
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
 --osm-tags-filter                                                           FUNCTION                                                         OSM tags used to filter the data in the JSON text form. Can take the form of a flat or grouped  
                                                                                                                                              dict (look: OsmTagsFilter and GroupedOsmTagsFilter). Cannot be used together with               
                                                                                                                                              osm-tags-filter-file.                                                                           
 --osm-tags-filter-file                                                      FUNCTION                                                         OSM tags used to filter the data in the JSON file form. Can take the form of a flat or grouped  
                                                                                                                                              dict (look: OsmTagsFilter and GroupedOsmTagsFilter). Cannot be used together with               
                                                                                                                                              osm-tags-filter.                                                                                
 --keep-all-tags,--all-tags                                                                                                                   Whether to keep all tags while filtering with OSM tags. Doesn't work when there is no OSM tags  
                                                                                                                                              filter applied (osm-tags-filter or osm-tags-filter-file). Will override grouping if             
                                                                                                                                              GroupedOsmTagsFilter has been passed as a filter.                                               
 --geom-filter-bbox                                                          FUNCTION                                                         Geometry to use as a filter in the bounding box format - 4 floating point numbers separated by  
                                                                                                                                              commas. Cannot be used together with other geom-filter-... parameters.                          
 --geom-filter-file                                                          FUNCTION                                                         Geometry to use as a filter in the file format - any that can be opened by GeoPandas. Will      
                                                                                                                                              return the unary union of the geometries in the file. Cannot be used together with other        
                                                                                                                                              geom-filter-... parameters.                                                                     
 --geom-filter-geocode                                                       FUNCTION                                                         Geometry to use as a filter in the string to geocode format - it will be geocoded to the        
                                                                                                                                              geometry using Nominatim API (GeoPy library). Cannot be used together with other                
                                                                                                                                              geom-filter-... parameters.                                                                     
 --geom-filter-geojson                                                       FUNCTION                                                         Geometry to use as a filter in the GeoJSON format. Cannot be used together with other           
                                                                                                                                              geom-filter-... parameters.                                                                     
 --geom-filter-index-geohash                                                 FUNCTION                                                         Geometry to use as a filter in the Geohash index format. Separate multiple values with a comma. 
                                                                                                                                              Cannot be used together with other geom-filter-... parameters.                                  
 --geom-filter-index-h3                                                      FUNCTION                                                         Geometry to use as a filter in the H3 index format. Separate multiple values with a comma.      
                                                                                                                                              Cannot be used together with other geom-filter-... parameters.                                  
 --geom-filter-index-s2                                                      FUNCTION                                                         Geometry to use as a filter in the S2 index format. Separate multiple values with a comma.      
                                                                                                                                              Cannot be used together with other geom-filter-... parameters.                                  
 --geom-filter-wkt                                                           FUNCTION                                                         Geometry to use as a filter in the WKT format. Cannot be used together with other               
                                                                                                                                              geom-filter-... parameters.                                                                     
 --custom-sql-filter                                                         TEXT                                                             Allows users to pass custom SQL conditions used to filter OSM features. It will be embedded     
                                                                                                                                              into predefined queries and requires DuckDB syntax to operate on tags map object.               
 --osm-extract-query                                                         TEXT                                                             Query to find an OpenStreetMap extract from available sources. Will automatically find and      
                                                                                                                                              download OSM extract. Can be used instead of PBF file path argument.                            
 --osm-extract-source,--pbf-download-source                                  [any|geofabrik|osmfr|bbbike|geo2day|movisda-admin|movisda-grid]  Source where to download the PBF file from. Can be Geofabrik, BBBike, OSMfr (OpenStreetMap.fr), 
                                                                                                                                              GEO2Day, Movisda-admin, Movisda-grid or any. Can be passed multiple times to combine sources    
                                                                                                                                              (e.g. --osm-extract-source BBBike --osm-extract-source OSMfr).                                  
                                                                                                                                              [default: (any)]                                                                                
 --select-first-match                            --no-select-first-match                                                                      When the OSM extract query matches multiple extracts by name, select the first one (sorted by   
                                                                                                                                              area ascending, then id) with a warning instead of raising an error.                            
                                                                                                                                              [default: select-first-match]                                                                   
 --explode-tags,--explode                        --compact-tags,--compact                                                                     Whether to split tags into columns based on the OSM tag keys. If None, it will be set based on  
                                                                                                                                              the osm-tags-filter/osm-tags-filter-file and keep-all-tags parameters. If there is a tags       
                                                                                                                                              filter applied without keep-all-tags then it'll be set to explode-tags (True). Otherwise it'll  
                                                                                                                                              be set to compact-tags (False).                                                                 
 --output                                    -o                              PATH                                                             Path where to save final result file. If not provided, it will be generated automatically based 
                                                                                                                                              on the input pbf file name. Can be .parquet or .db or .duckdb extension.                        
 --duckdb                                                                                                                                     Export to duckdb database. If not provided, data can still be exported if output has .db or     
                                                                                                                                              .duckdb extension.                                                                              
 --duckdb-table-name                                                         TEXT                                                             Table name which the data will be imported into in the DuckDB database. [default: quackosm]     
 --compression                                                               TEXT                                                             Compression of the final parquet file. [default: zstd]                                          
 --compression-level                                                         INTEGER                                                          Compression level of the final parquet file. Supported only for zstd compression. [default: 3]  
 --row-group-size                                                            INTEGER                                                          Approximate number of rows per row group in the final parquet file. [default: 100000]           
 --parquet-version                                                           TEXT                                                             Type of parquet version used to save final file. Supported options: v1 and v2. [default: v2]    
 --ignore-cache,--no-cache                                                                                                                    Whether to ignore previously precalculated geoparquet files or not.                             
 --working-directory,--work-dir                                              PATH                                                             Directory where to save the parsed parquet and geoparquet files. Will be created if doesn't     
                                                                                                                                              exist.                                                                                          
                                                                                                                                              [default: files]                                                                                
 --osm-way-polygon-config                                                    PATH                                                             Config where alternative OSM way polygon features config is defined. Will determine how to      
                                                                                                                                              parse way features based on tags. Option is intended for experienced users. It's recommended to 
                                                                                                                                              disable cache (no-cache) when using this option, since file names don't contain information     
                                                                                                                                              what config file has been used for file generation.                                             
 --filter-osm-ids                                                            TEXT                                                             List of OSM features IDs to read from the file. Have to be in the form of 'node/<id>',          
                                                                                                                                              'way/<id>' or 'relation/<id>'. Separate multiple values with a comma.                           
 --sort                                          --no-sort                                                                                    Whether to sort the final geoparquet file by geometry or not. [default: sort]                   
 --sort-algorithm                                                            TEXT                                                             Algorithm used to sort the final geoparquet file by geometry. Supported options: str            
                                                                                                                                              (Sort-Tile-Recursive) and hilbert (Hilbert curve).                                              
                                                                                                                                              [default: str]                                                                                  
 --ignore-metadata-tags                          --keep-metadata-tags                                                                         Whether to remove metadata tags, based on the default GDAL config.                              
                                                                                                                                              [default: ignore-metadata-tags]                                                                 
 --wkt-result,--wkt                                                                                                                           Whether to save the geometry as a WKT string instead of WKB blob.                               
 --silent                                                                                                                                     Whether to disable progress reporting.                                                          
 --transient                                                                                                                                  Whether to make more transient (concise) progress reporting.                                    
 --iou-threshold                                                             FLOAT RANGE [0<=x<=1]                                            Minimal value of the Intersection over Union metric for selecting the matching OSM extracts. Is 
                                                                                                                                              best matching extract has value lower than the threshold, it is discarded (except the first     
                                                                                                                                              one). Has to be in range between 0 and 1. Value of 0 will allow every intersected extract,      
                                                                                                                                              value of 1 will only allow extracts that match the geometry exactly. Works only when            
                                                                                                                                              PbfFileReader is asked to download OSM extracts automatically.                                  
                                                                                                                                              [default: 0.01]                                                                                 
 --allow-uncovered-geometry                                                                                                                   Suppresses an error if some geometry parts aren't covered by any OSM extract. Works only when   
                                                                                                                                              PbfFileReader is asked to download OSM extracts automatically.                                  
 --cpu-limit                                                                 INTEGER                                                          Max number of threads available for processing. By default, will use all available threads.     
 --show-extracts,--show-osm-extracts                                                                                                          Show available OSM extracts and exit.                                                           
 --version                                   -v                                                                                               Show the application's version and exit.                                                        
 --install-completion                                                                                                                         Install completion for the current shell.                                                       
 --show-completion                                                                                                                            Show completion for the current shell, to copy it or customize the installation.                
 --help                                                                                                                                       Show this message and exit.                                                                     
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯