GDAL VSICURL tests to remote BDTOPO Geopackage France
✓ Published0🌍 Public
TThomasG77
Last edited Mar 7, 2022
Created on Mar 7, 2022
This example tests GDAL’s VSICURL virtual file system by streaming a remote GeoPackage of French administrative data, specifically focusing on mairie (town hall) geometries. It demonstrates two ogr2ogr commands that query the BDTOPO dataset using SQL joins to extract mairie footprints as multipolygons and their centroids as points, converting them to GeoJSON with EPSG:4326. The visualization shows how both polygon boundaries and point locations are derived from the same remote source, highlighting the ability to perform spatial SQL operations directly on cloud-hosted vector data without local downloads.
AI-generated descriptionGDAL VSICURL tests to remote BDTOPO Geopackage France
# MultiPolygon output
ogr2ogr -f GeoJSON /tmp/mairies_multipolygons.geojson "/vsicurl/https://labs.webgeodatavore.com/partage/bdtopo.gpkg" \
-lco RFC7946=YES \
-sql "SELECT code_insee, nom_officiel, liens_vers_autorite_administrative, zone_d_activite_ou_d_interet.* FROM commune LEFT JOIN zone_d_activite_ou_d_interet ON liens_vers_autorite_administrative = zone_d_activite_ou_d_interet.cleabs"
# Point output
ogr2ogr -f GeoJSON /tmp/mairies_points.geojson "/vsicurl/https://labs.webgeodatavore.com/partage/bdtopo.gpkg" \
-lco RFC7946=YES \
-sql "SELECT code_insee, nom_officiel, liens_vers_autorite_administrative, zone_d_activite_ou_d_interet.cleabs, categorie, nature, nature_detaillee, toponyme, statut_du_toponyme, importance, fictif, etat_de_l_objet, zone_d_activite_ou_d_interet.date_d_apparition, zone_d_activite_ou_d_interet.date_de_confirmation, sources, identifiants_sources, precision_planimetrique, zone_d_activite_ou_d_interet.date_modification, zone_d_activite_ou_d_interet.date_creation, ST_PointOnSurface(zone_d_activite_ou_d_interet.geometrie) AS geom FROM commune LEFT JOIN zone_d_activite_ou_d_interet ON liens_vers_autorite_administrative = zone_d_activite_ou_d_interet.cleabs"