ogr2ogr

Convert Simple Features data between file formats.

TLDR

Convert a Shapefile into a GeoPackage

>_ ogr2ogr -f GPKG [output].gpkg [input].shp
copy

Change coordinate reference system of a GeoPackage from EPSG:4326 to EPSG:3857

>_ ogr2ogr -s_srs [EPSG:4326] -t_srs [EPSG:3857] -f GPKG [output].gpkg [input].gpkg
copy

Convert a CSV file into a GeoPackage, specifying the names of the coordinate columns and assigning a coordinate reference system

>_ ogr2ogr -f GPKG [output].gpkg [input].csv -oo X_POSSIBLE_NAMES=[longitude] -oo Y_POSSIBLE_NAMES=[latitude] -a_srs [EPSG:4326]
copy

Load a GeoPackage into a PostGIS database

>_ ogr2ogr -f "PostgreSQL" PG:dbname="[database_name]" [input].gpkg
copy

Clip layers of a GeoPackage file to the given bounding box

>_ ogr2ogr -spat [min_x] [min_y] [max_x] [max_y] -f GPKG [output].gpkg [input].gpkg
copy

Copied to clipboard
free 100$ digital ocean credit