**What it does:** Reads a Shapefile (local or remote) directly in DuckDB using the Spatial extension and converts it to GeoParquet ... no GDAL CLI, no QGIS,no ArcGIS no downloads. Perfect for quickly modernizing legacy GIS data or pushing old formats into high-performance analytics. ![[Pasted image 20251117005316.png]] --- ## **SQL** ```sql -- Enable Spatial and HTTPFS (install only once, load every session) INSTALL spatial; LOAD spatial; INSTALL httpfs; LOAD httpfs; -- Read a Shapefile directly from a remote HTTP(S) URL (or replace with a local path) SELECT * FROM ST_ReadSHP( 'https://raw.githubusercontent.com/OSGeo/gdal/master/autotest/ogr/data/poly.shp' ); -- Convert the Shapefile into a Parquet file COPY ( SELECT * FROM ST_ReadSHP( 'https://raw.githubusercontent.com/OSGeo/gdal/master/autotest/ogr/data/poly.shp' ) ) TO 'poly.parquet' ( FORMAT PARQUET, PARQUET_VERSION V2 ); ``` --- ## DuckDB-WASM Shell - **Try it live:** 🔗 [https://cutt.ly/DuckDB-Snippet-2](https://cutt.ly/DuckDB-Snippet-2) <iframe src="https://shell.duckdb.org/#queries=v0,INSTALL-spatial~%0ALOAD-spatial~%0AINSTALL-httpfs~%0ALOAD-httpfs~,SELECT-*-FROM-ST_ReadSHP('https%3A%2F%2Fraw.githubusercontent.com%2FOSGeo%2Fgdal%2Fmaster%2Fautotest%2Fogr%2Fdata%2Fpoly.shp')~,COPY-(%0A--SELECT-*-%0A--FROM-ST_ReadSHP('https%3A%2F%2Fraw.githubusercontent.com%2FOSGeo%2Fgdal%2Fmaster%2Fautotest%2Fogr%2Fdata%2Fpoly.shp')%0A)-TO-'poly.parquet'-(FORMAT-PARQUET-%2C-PARQUET_VERSION-V2)~" width="100%" height="740" style="border: 1px solid black;"> </iframe> --- ## Downloading the generated Parquet file in DuckDB-WASM Shell To see files created in memory write this command after `duckdb>`: ```sql .files ``` Example output: ```bash ┌──────────────┬───────────┬──────────┬────────────┐ │ File Name ┆ File Size ┆ Protocol ┆ Statistics │ ╞══════════════╪═══════════╪══════════╪════════════╡ │ poly.parquet ┆ 2.79 kB ┆ Buffer ┆ false │ └──────────────┴───────────┴──────────┴────────────┘ ``` To download it: ```sql .files download poly.parquet ``` Your browser will immediately start downloading the generated Parquet file. ___ #Linkedin : https://www.linkedin.com/feed/update/urn:li:activity:7395961203920908289/