Export Shape File or GeoJson file to Postgis using Ogr2Ogr

For exporting  GIS shapefile to a postgresql database we can use ogr2ogr  command, example:

 

ogr2ogr -t_srs EPSG:3857 -f PostgreSQL “PG:dbname=databasename user=databaseuser” test.shp

 

In example above we export  (test.shp) to database: “databasename with a dbuser: “databaseuser”  with SRID= EPSG:3857

 

For exporting a geojson file into Postgis

ogr2ogr -f “PostgreSQL” PG:”PG:dbname=databasename user=databaseuser” “test.geojson”

 

In example above we export  (test.geojson) to database: “databasename with a dbuser: “databaseuser” 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *