Last active
December 30, 2024 03:42
-
-
Save mikaelhg/0df898a1801238d112ac6e1d0beabd33 to your computer and use it in GitHub Desktop.
Convert Natural Places SHP to geoparquet
This file contains hidden or 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
# Convert Natural Places SHP to geoparquet | |
docker run -it --rm -u 1000:1000 -v `pwd`:/app -w /app ghcr.io/osgeo/gdal:alpine-normal-latest \ | |
ogr2ogr -f geojson ne_10m_populated_places.geojson \ | |
'/vsizip//vsicurl?referer=https://www.naturalearthdata.com/&url=https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places.zip' | |
docker run -it --rm -u 1000:1000 -v `pwd`:/app -w /app ghcr.io/osgeo/gdal:alpine-normal-latest \ | |
ogr2ogr -f parquet -lco COMPRESSION=ZSTD ne_10m_populated_places.geoparquet ne_10m_populated_places.geojson | |
# Filter | |
jq ' | |
.features |= map( | |
select(.properties.POP_MAX > 100000) | | |
.properties |= with_entries( | |
select(.key | IN("SOV0NAME", "NAME_EN", "WIKIDATAID", "GEONAMESID", "TIMEZONE")) | |
) | |
) | del(.features) + {features: .features} | |
' ne_10m_populated_places.geojson > cities.geojson | |
zstd -fk -19 cities.geojson |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment