### Build and Run openstreetmap_h3 with Docker Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md This snippet provides commands to clone the repository, build Docker images for the `openstreetmap_h3` application and a PostGIS database, download an OpenStreetMap PBF file, and then run the application to process the PBF into TSV, followed by launching a PostGIS container to load the data. It configures the PostGIS container with specific memory and WAL settings for performance. ```Bash git clone https://github.com/igor-suhorukov/openstreetmap_h3.git cd openstreetmap_h3 && docker build -t openstreetmap_h3 . cd postgis_docker-master && docker build -t postgres16_postgis . wget https://download.geofabrik.de/europe/cyprus-latest.osm.pbf docker run -it --rm -w $(pwd) -v $(pwd):/$(pwd) openstreetmap_h3:latest -source_pbf $(pwd)/cyprus-latest.osm.pbf -result_in_tsv true docker run --name postgis16-cyprus --memory=12g --memory-swap=12g --memory-swappiness 0 --shm-size=1g -v $(pwd)/database:/var/lib/postgresql/data -v $(pwd)/cyprus-latest_loc_ways:/input -e POSTGRES_PASSWORD=osmworld -d -p 5432:5432 postgres16_postgis:latest -c checkpoint_timeout='15 min' -c checkpoint_completion_target=0.9 -c shared_buffers='4096 MB' -c wal_buffers=-1 -c bgwriter_delay=200ms -c bgwriter_lru_maxpages=100 -c bgwriter_lru_multiplier=2.0 -c bgwriter_flush_after=0 -c max_wal_size='32768 MB' -c min_wal_size='16384 MB' ``` -------------------------------- ### View PostGIS Container Startup and Import Logs Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md Retrieves the last 40 lines of logs from the `postgis14-thailand` Docker container. The logs provide insights into the PostgreSQL server's initialization, listening interfaces, database readiness, and a sequence of DDL/DML operations (e.g., `CREATE TABLE`, `COPY`, `ANALYZE`, `SELECT`) with their execution times, indicating successful data import and indexing. It also shows a server shutdown sequence. ```Shell docker logs postgis14-thailand | tail -n 40 ``` -------------------------------- ### Build openstreetmap_h3 with Maven (JVM) Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md This snippet demonstrates the process and output of building the `openstreetmap_h3` project using Apache Maven. It shows the successful compilation of source files and packaging of the application into a JAR file, indicating a successful build for JVM environments. ```Bash ~/dev/projects/oss_contrib/openstreetmap_h3$ mvn install [INFO] Scanning for projects... [INFO] [INFO] -------< com.github.igor-suhorukov:osm-to-pgsnapshot-schema-ng >-------- [INFO] Building osm-to-pgsnapshot-schema-ng 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ osm-to-pgsnapshot-schema-ng --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 12 resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ osm-to-pgsnapshot-schema-ng --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 24 source files to /home/acc/dev/projects/oss_contrib/openstreetmap_h3/target/classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ osm-to-pgsnapshot-schema-ng --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /home/acc/dev/projects/oss_contrib/openstreetmap_h3/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ osm-to-pgsnapshot-schema-ng --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ osm-to-pgsnapshot-schema-ng --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ osm-to-pgsnapshot-schema-ng --- [INFO] Building jar: /home/acc/dev/projects/oss_contrib/openstreetmap_h3/target/osm-to-pgsnapshot-schema-ng-1.0-SNAPSHOT.jar [INFO] [INFO] --- spring-boot-maven-plugin:2.7.3:repackage (default) @ osm-to-pgsnapshot-schema-ng --- [INFO] Layout: ZIP [INFO] Replacing main artifact with repackaged archive [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ osm-to-pgsnapshot-schema-ng --- [INFO] Installing /home/acc/dev/projects/oss_contrib/openstreetmap_h3/target/osm-to-pgsnapshot-schema-ng-1.0-SNAPSHOT.jar to /home/acc/.m2/repository/com/github/igor-suhorukov/osm-to-pgsnapshot-schema-ng/1.0-SNAPSHOT/osm-to-pgsnapshot-schema-ng-1.0-SNAPSHOT.jar [INFO] Installing /home/acc/dev/projects/oss_contrib/openstreetmap_h3/pom.xml to /home/acc/.m2/repository/com/github/igor-suhorukov/osm-to-pgsnapshot-schema-ng/1.0-SNAPSHOT/osm-to-pgsnapshot-schema-ng-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 29.592 s [INFO] Finished at: 2023-01-29T11:47:33+03:00 [INFO] ------------------------------------------------------------------------ ``` -------------------------------- ### Connect to PostGIS Database and List Tables Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md Establishes an interactive `psql` session within the running `postgis14-thailand` Docker container, connecting to the `osmworld` database as the `postgres` user. The `\d` meta-command is then used to list all relations (tables, views) in the `public` schema, demonstrating the successful import and creation of various OpenStreetMap-related tables like `multipolygon`, `nodes`, `relations`, and `h3_3_bounds_complex`. ```Shell docker exec -it postgis14-thailand psql -U postgres -d osmworld ``` ```SQL \d ``` -------------------------------- ### Launching Spark Shell with Geospatial Dependencies Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md This command initiates the Apache Spark shell, pre-loading it with essential geospatial libraries like Apache Sedona and GeoTools. It configures Spark SQL extensions for advanced spatial operations, enabling the processing of OpenStreetMap H3 data within a distributed Spark environment. ```Shell ./spark-shell --packages org.apache.sedona:sedona-python-adapter-3.0_2.12:1.3.1-incubating,org.apache.sedona:sedona-viz-3.0_2.12:1.3.1-incubating,org.datasyslab:geotools-wrapper:1.3.0-27.2 --conf spark.sql.extensions=org.apache.sedona.sql.SedonaSqlExtensions ``` -------------------------------- ### Run PostGIS Docker Container with Optimized Settings Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md Launches a PostGIS 14 Docker container, `postgis14-thailand`, with significant memory allocations (12GB RAM, 12GB swap), 1GB shared memory, and volume mounts for persistent data and input files. It sets the PostgreSQL password, exposes ports 5432 and 5005, and applies performance-tuning parameters like `checkpoint_timeout`, `shared_buffers`, `max_wal_size`, and `min_wal_size` to optimize for large data imports and database operations. ```Shell docker run --name postgis14-thailand --memory=12g --memory-swap=12g --memory-swappiness 0 --shm-size=1g -v /home/acc/dev/map/database/thailand:/var/lib/postgresql/data -v /home/acc/dev/map/thailand/thailand-latest_loc_ways:/input -e POSTGRES_PASSWORD=osmworld -e LD_LIBRARY_PATH=/usr/lib/jvm/java-11-openjdk-amd64/lib/server/ -d -p 5432:5432 -p 5005:5005 5d411c3be57f -c checkpoint_timeout='15 min' -c checkpoint_completion_target=0.9 -c shared_buffers='4096 MB' -c wal_buffers=-1 -c bgwriter_delay=200ms -c bgwriter_lru_maxpages=100 -c bgwriter_lru_multiplier=2.0 -c bgwriter_flush_after=0 -c max_wal_size='32768 MB' -c min_wal_size='16384 MB' ``` -------------------------------- ### Command-line Usage for OpenStreetMap H3 Data Processor Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md This snippet shows how to execute the `osm-to-pgsnapshot-schema-ng` Java application from the command line and lists all available options. The tool processes OpenStreetMap PBF files, allowing users to control data partitioning, storage formats, and filtering of specific map features like buildings or highways. ```Shell ~/dev/projects/oss_contrib/openstreetmap_h3$ java -jar target/osm-to-pgsnapshot-schema-ng-1.0-SNAPSHOT.jar The following option is required: [-source_pbf] Usage:
[options] Options: * -source_pbf Source path for OpenStreetMap data in PBF format -collect_only_statistics Collect only statistics from data - partition distribution Default: false -columnar_storage Use columnar storage in PostgreSql tables for nodes/ways/multipolygon Default: false -data_partition_ratio Filling ratio from maximum size of partition. This parameter change PostgreSQL partitions count Default: 0.48 -help Information about command line parameters -pg_script_count Script count for PostgreSQL parallel COPY Default: 4 -preserve_all_nodes Preserve all nodes information in case of 'true' or only nodes with tags or referenced from relations in other case Default: false -arrow_format In case of not null parameter save Arrow data serialization: ARROW_IPC or PARQUET Possible Values: [PARQUET, ARROW_IPC] -result_in_tsv Save result data in TabSeparatedValue format for PostgreSQL COPY Default: true -scale_approx_calc Approximate scale calculation. Value 'false' - distance in meter Default: false -skip_buildings Skip any ways with 'building' tag Default: false -skip_highway Skip any ways with 'highway' tag Default: false -worker_threads Worker threads count for data processing Default: 4 ``` -------------------------------- ### Convert OpenStreetMap PBF to PostgreSQL Snapshot Schema using Java Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md Executes a custom Java application to process an OpenStreetMap PBF file. This tool leverages Osmium to add location data to ways and prepare the data for a PostgreSQL snapshot schema. The output details the processing steps, memory usage, and counts of processed OSM elements. ```shell ~/dev/projects/oss_contrib/openstreetmap_h3$ java -jar target/osm-to-pgsnapshot-schema-ng-1.0-SNAPSHOT.jar -source_pbf /home/acc/dev/map/thailand/thailand-latest.osm.pbf [ 0:00] Started osmium add-locations-to-ways [ 0:00] osmium version 1.14.0 [ 0:00] libosmium version 2.18.0 [ 0:00] Command line options and default settings: [ 0:00] input options: [ 0:00] file names: [ 0:00] thailand-latest.osm.pbf [ 0:00] file format: [ 0:00] output options: [ 0:00] file name: thailand-latest_loc_ways.pbf [ 0:00] file format: pbf,pbf_compression=none [ 0:00] generator: osmium/1.14.0 [ 0:00] overwrite: no [ 0:00] fsync: no [ 0:00] other options: [ 0:00] index type (for positive ids): sparse_mem_array [ 0:00] index type (for negative ids): flex_mem [ 0:00] keep untagged nodes: no [ 0:00] keep nodes that are relation members: yes [ 0:00] [ 0:00] Getting all nodes referenced from relations... [ 0:01] Found 7508 nodes referenced from relations. [ 0:01] Copying input file 'thailand-latest.osm.pbf'... [ 0:13] About 540 MBytes used for node location index (in main memory or on disk). [ 0:13] Peak memory used: 2152 MBytes [ 0:13] Done. 0 566 time 89572 diff between total and processing 45908 total thread time 358078 total processing time 312170 total save time 9689 total waiting for save time 23255 thread max time 2482 processing max time 2065 nodes 382390 ways 4117237 relations 18317 relation members 191294 multipolygon count 6995 0 [-32768,25648) 67392403 58416 1 [25648,25728) 46338970 80 2 [25728,25744) 87393905 16 3 [25744,25760) 41088683 16 4 [25760,25768) 204997591 8 5 [25768,25880) 78535020 112 6 [25880,25992) 41090100 112 7 [25992,26000) 84484353 8 8 [26000,26008) 17026978 8 9 [26008,26016) 135197249 8 10 [26016,32695) 223367 6679 11 0 73.06987445454546 [ 0:00] Started osmium export [ 0:00] osmium version 1.14.0 [ 0:00] libosmium version 2.18.0 [ 0:00] Command line options and default settings: [ 0:00] input options: [ 0:00] file name: thailand-latest.osm.pbf [ 0:00] file format: [ 0:00] output options: [ 0:00] file name: thailand-latest_loc_ways/multipolygon/source.tsv [ 0:00] file format: pg [ 0:00] overwrite: no [ 0:00] fsync: yes [ 0:00] attributes: [ 0:00] type: @type [ 0:00] id: @id [ 0:00] version: (omitted) [ 0:00] changeset: (omitted) [ 0:00] timestamp: (omitted) [ 0:00] uid: (omitted) [ 0:00] user: (omitted) [ 0:00] way_nodes: (omitted) [ 0:00] output format options: [ 0:00] tags_type = hstore [ 0:00] linear tags: none [ 0:00] area tags: one of the following: [ 0:00] @type=relation [ 0:00] other options: [ 0:00] index type: sparse_mem_array [ 0:00] add unique IDs: no [ 0:00] keep untagged features: no [ 0:00] [ 0:00] Create table with something like this: [ 0:00] CREATE EXTENSION IF NOT EXISTS hstore; [ 0:00] CREATE TABLE osmdata ( [ 0:00] geom GEOMETRY, -- or GEOGRAPHY [ 0:00] osm_type TEXT, [ 0:00] osm_id BIGINT, [ 0:00] tags hstore ); [ 0:00] Then load data with something like this: [ 0:00] \copy osmdata FROM 'thailand-latest_loc_ways/multipolygon/source.tsv' [ 0:00] [ 0:00] First pass (of two) through input file (reading relations)... [ 0:01] First pass done. [ 0:01] Second pass (of two) through input file... Geometry error: Could not build area geometry Geometry error: Could not build area geometry Geometry error: Could not build area geometry Geometry error: Could not build area geometry Geometry error: Could not build area geometry Geometry error: Could not build area geometry Geometry error: Could not build area geometry Geometry error: Could not build area geometry Geometry error: Could not build area geometry [ 0:20] About 540 MBytes used for node location index (in main memory or on disk). [ 0:20] Second pass done. [ 0:20] Wrote 156178 features. [ 0:20] Encountered 9 errors. [ 0:20] Peak memory used: 2134 MBytes [ 0:20] Done. ``` -------------------------------- ### PostgreSQL EXPLAIN Plan for H3 Group By Query on Partitioned Table Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md This snippet provides the EXPLAIN plan for a SQL query that groups 'ways' by the 'h3_3' column and counts the occurrences. The plan demonstrates how PostgreSQL performs a 'Parallel Append' operation across multiple partitions (e.g., 'ways_000' to 'ways_32767') to execute the GROUP BY and COUNT aggregation efficiently, showcasing the query optimizer's strategy for partitioned tables. ```PostgreSQL osmworld=# explain select h3_3, count(*) from ways group by 1; QUERY PLAN ------------------------------------------------------------------------------------------- Gather (cost=34456.99..97465.64 rows=76 width=10) Workers Planned: 4 -> Parallel Append (cost=33456.99..96458.04 rows=19 width=10) -> HashAggregate (cost=96457.88..96457.95 rows=7 width=10) Group Key: ways_4.h3_3 -> Seq Scan on ways_004 ways_4 (cost=0.00..90269.92 rows=1237592 width=2) -> HashAggregate (cost=60359.46..60359.53 rows=7 width=10) Group Key: ways_9.h3_3 -> Seq Scan on ways_009 ways_9 (cost=0.00..56666.64 rows=738564 width=2) -> HashAggregate (cost=39018.48..39018.54 rows=6 width=10) Group Key: ways_7.h3_3 -> Seq Scan on ways_007 ways_7 (cost=0.00..36567.32 rows=490232 width=2) -> HashAggregate (cost=33456.99..33457.06 rows=7 width=10) Group Key: ways_2.h3_3 -> Seq Scan on ways_002 ways_2 (cost=0.00..31580.66 rows=375266 width=2) -> HashAggregate (cost=30029.44..30029.53 rows=9 width=10) Group Key: ways_5.h3_3 -> Seq Scan on ways_005 ways_5 (cost=0.00..28346.96 rows=336496 width=2) -> HashAggregate (cost=26775.62..26775.72 rows=10 width=10) Group Key: ways.h3_3 -> Seq Scan on ways_000 ways (cost=0.00..25251.75 rows=304775 width=2) -> HashAggregate (cost=19023.96..19024.03 rows=7 width=10) Group Key: ways_1.h3_3 -> Seq Scan on ways_001 ways_1 (cost=0.00..17901.97 rows=224397 width=2) -> HashAggregate (cost=15682.35..15682.43 rows=8 width=10) Group Key: ways_6.h3_3 -> Seq Scan on ways_006 ways_6 (cost=0.00..14803.23 rows=175823 width=2) -> HashAggregate (cost=13881.85..13881.90 rows=5 width=10) Group Key: ways_3.h3_3 -> Seq Scan on ways_003 ways_3 (cost=0.00..13173.90 rows=141590 width=2) -> HashAggregate (cost=6970.89..6970.92 rows=3 width=10) Group Key: ways_8.h3_3 -> Seq Scan on ways_008 ways_8 (cost=0.00..6567.26 rows=80726 width=2) -> HashAggregate (cost=2385.09..2385.10 rows=1 width=10) Group Key: ways_11.h3_3 -> Seq Scan on ways_32767 ways_11 (cost=0.00..2327.06 rows=11606 width=2) -> HashAggregate (cost=37.55..37.59 rows=4 width=10) Group Key: ways_10.h3_3 -> Seq Scan on ways_010 ways_10 (cost=0.00..36.70 rows=170 width=2) (39 rows) ``` -------------------------------- ### Querying OpenStreetMap Ways for Schools with Spark SQL (Scala) Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md This snippet demonstrates how to load OpenStreetMap 'ways' data from Parquet files into a Spark DataFrame, create a temporary view, and then execute a Spark SQL query to find closed ways tagged as 'school' buildings or amenities. It utilizes spatial functions like ST_GeomFromWKB and ST_SetSRID to convert WKB to geometry for spatial analysis. ```scala val ways = spark.read.parquet("/home/geo/dev/map/phuket3/phuket_loc_ways/arrow/ways/*.parquet") ways.createOrReplaceTempView("ways") spark.time(sql("select id,h33,tags,ST_SetSRID(ST_GeomFromWKB(lineStringWkb),4326) wkb_str from ways where closed and (tags['building']='school' or (tags['building'] is not null and tags['amenity']='school')) limit 50")).show() ``` -------------------------------- ### PostgreSQL Schema for OpenStreetMap H3 Partitioned Tables Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md This snippet displays the schema of a PostgreSQL database, specifically showing the 'ways' table partitioned by H3 index. It lists the main 'ways' partitioned table and its numerous partitions (e.g., 'ways_000', 'ways_001', 'ways_32767'), along with the 'spatial_ref_sys' table, indicating a structured approach to managing large spatial datasets. ```PostgreSQL public | spatial_ref_sys | table | postgres public | ways | partitioned table | postgres public | ways_000 | table | postgres public | ways_001 | table | postgres public | ways_002 | table | postgres public | ways_003 | table | postgres public | ways_004 | table | postgres public | ways_005 | table | postgres public | ways_006 | table | postgres public | ways_007 | table | postgres public | ways_008 | table | postgres public | ways_009 | table | postgres public | ways_010 | table | postgres public | ways_32767 | table | postgres (49 rows) ``` -------------------------------- ### OpenStreetMap Way Data Model Schema (APIDOC) Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md This section describes the schema for the OpenStreetMap 'Way' data, stored in Parquet format. It includes fields for identifiers, H3 indexes, geographic coordinates, tags, point indices, H3 center, closed status, building/highway flags, scale, and WKB representations for line strings and bounding boxes. ```APIDOC root |-- id: long (nullable = true) |-- h33: short (nullable = true) |-- h38: integer (nullable = true) |-- latitude: double (nullable = true) |-- longitude: double (nullable = true) |-- tags: map (nullable = true) | |-- key: string | |-- value: string (valueContainsNull = true) |-- pointIdxs: array (nullable = true) | |-- element: long (containsNull = true) |-- h33Center: short (nullable = true) |-- closed: boolean (nullable = true) |-- building: boolean (nullable = true) |-- highway: boolean (nullable = true) |-- scale: float (nullable = true) |-- lineStringWkb: binary (nullable = true) |-- bboxWkb: binary (nullable = true) |-- h38Indexes: array (nullable = true) | |-- element: integer (containsNull = true) |-- bboxMinX: double (nullable = true) |-- bboxMaxX: double (nullable = true) |-- bboxMinY: double (nullable = true) |-- bboxMaxY: double (nullable = true) ``` -------------------------------- ### OpenStreetMap Node Data Model Schema (APIDOC) Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md This section outlines the schema for the OpenStreetMap 'Node' data, as represented in Parquet files. It details the fields available, including unique identifiers, H3 indexes, geographic coordinates (latitude, longitude), and a map of tags for various attributes. ```APIDOC root |-- id: long (nullable = true) |-- h33: short (nullable = true) |-- h38: integer (nullable = true) |-- latitude: double (nullable = true) |-- longitude: double (nullable = true) |-- tags: map (nullable = true) | |-- key: string | |-- value: string (valueContainsNull = true) ``` -------------------------------- ### OpenStreetMap Relation Data Model Schema (APIDOC) Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md This section details the schema for the OpenStreetMap 'Relation' data in Parquet format. It includes fields for the relation's identifier, associated tags, and arrays for member IDs, types, and roles, defining the components and structure of the relation. ```APIDOC root |-- id: long (nullable = true) |-- tags: map (nullable = true) | |-- key: string | |-- value: string (valueContainsNull = true) |-- memberId: array (nullable = true) | |-- element: long (containsNull = true) |-- memberType: array (nullable = true) | |-- element: byte (containsNull = true) |-- memberRole: array (nullable = true) | |-- element: string (containsNull = true) ``` -------------------------------- ### Examine Processed OpenStreetMap Data Directory Structure Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md Displays the resulting directory and file structure after the OpenStreetMap PBF processing. It shows how different types of OSM data (metadata, multipolygons, nodes) are organized into separate TSV files within dedicated subdirectories. ```shell ~/dev/map/thailand/thailand-latest_loc_ways$ tree . ├── import_related_metadata │   ├── osm_file_block_content.tsv │   ├── osm_file_block.tsv │   └── osm_file_statistics.tsv ├── multipolygon │   ├── multipolygon_aa │   ├── multipolygon_ab │   ├── multipolygon_ac │   ├── multipolygon_ad │   └── multipolygon_ae ├── nodes │   ├── 16713.tsv │   ├── 16717.tsv │   ├── 16744.tsv │   ├── 16745.tsv │   ├── 16747.tsv │   ├── 16748.tsv │   ├── 16749.tsv │   ├── 25600.tsv │   ├── 25601.tsv │   ├── 25606.tsv │   ├── 25620.tsv │   ├── 25622.tsv │   ├── 25632.tsv │   ├── 25634.tsv │   ├── 25636.tsv │   ├── 25638.tsv │   └── 25648.tsv ``` -------------------------------- ### Split Large OSM Multipolygon TSV Files Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md Demonstrates how to use standard Unix commands (`cat`, `grep`, `split`) to filter and divide a large TSV file containing OpenStreetMap multipolygon relation data into smaller, more manageable files. This is useful for parallel processing or importing into databases with size constraints. ```shell cat /home/acc/dev/map/thailand/thailand-latest_loc_ways/multipolygon/source.tsv | grep $'\trelation\t' | split -l 1749 - /home/acc/dev/map/thailand/thailand-latest_loc_ways/multipolygon/multipolygon_ ``` -------------------------------- ### OpenStreetMap Multipolygon Data Model Schema (APIDOC) Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md This section presents the schema for OpenStreetMap 'Multipolygon' data, stored in a Parquet file. It includes fields for the multipolygon's identifier, its WKB hexadecimal representation, and a JSON string of its tags, providing a structured view of complex geographical features. ```APIDOC root |-- id: long (nullable = true) |-- wkb_hex: string (nullable = true) |-- tags_json: string (nullable = true) ``` -------------------------------- ### Top H3 Cells by Count in OpenStreetMap Ways Table Source: https://github.com/igor-suhorukov/openstreetmap_h3/blob/master/README.md This snippet shows the result of a SQL query that identifies the top 20 H3 cells ('h3_3') with the highest number of entries in the 'ways' table. It orders the results by count in descending order, providing insights into the most densely populated H3 regions within the dataset, which can be useful for spatial analysis and resource allocation. ```PostgreSQL osmworld=# select h3_3, count(*) from ways group by 1 order by 2 desc limit 20; h3_3 | count -------+-------- 25764 | 890643 26010 | 329973 25994 | 203645 25730 | 188810 25995 | 139373 26011 | 136930 25780 | 118165 25765 | 105996 26009 | 100196 25762 | 91177 26014 | 75555 26003 | 71479 26008 | 70353 25883 | 60808 25634 | 59705 25777 | 58151 16749 | 57887 25782 | 57509 25638 | 57296 25880 | 56838 (20 rows) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.