Created
October 10, 2024 15:13
-
-
Save geobabbler/dc4d1d15e2778fb42a8fca3c02fd2654 to your computer and use it in GitHub Desktop.
GeoJSON from DuckDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH geodata AS ( | |
SELECT | |
ROW_NUMBER() OVER () AS OBJECTID, | |
* | |
FROM | |
read_parquet('~/Downloads/IRL.parquet') LIMIT 1000) | |
select json_object( | |
'type', 'FeatureCollection', | |
'features', array_agg( | |
json_object( | |
'type', 'Feature', | |
'geometry', ST_AsGeoJSON(geometry), | |
'properties', json_object( | |
'bf_source', bf_source, | |
'boundary_id', boundary_id, | |
'confidence', confidence, | |
'area_in_meters', area_in_meters, | |
's2_id', s2_id, | |
'country_iso', country_iso, | |
'geohash', geohash, | |
'OBJECTID', OBJECTID | |
) | |
) | |
) | |
) AS geojson_featurecollection | |
FROM geodata; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment