How do I export a vector shapefile to PostGIS database? I am asking what format I have to export it.
closed as unclear what you're asking by neogeomat, aldo_tapia, nmtoken, Vince, whyzar May 11 '18 at 13:05
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
As @oyvind suggested, shp2pgsql is the best method for just getting the data into a PostGIS database. OpenGEO has a good startup guide for loading data into PostGIS that should get you up and running if you're having issues. As @nathanw pointed out, DB Manager is a good option for importing a shapefile into a database. Also available is PostGIS Manager, which is a great option if you're working specifically with PostGIS. @underdark has a great blog post about how to use it.
You'll need the database connection information (username, hostname or host address, and database name) as well as the SRID for the shapefile, but that is all covered in the OpenGEO startup guide. Good luck!
You can use the DBManager core plugin
To export your vector file, with re-projection option using ogr2ogr, here is the command line:
ogr2ogr -overwrite -progress --config PG_USE_COPY YES -f PostgreSQL PG:"host=Your_host port=your_DB_port(5432) dbname=your_DB_name password=DB_password user=DB_user" dir_to_your_Vector(.shp, .gml, .geojson...) -nlt MULTIPOLYGON -lco SCHEMA=your_DB_schema(public) -lco GEOMETRY_NAME=geom -lco FID=id -nln your_Output_Table_Name -s_srs EPSG:your_Source_EPSG_code -t_srs EPSG:your_Target_EPSG_code
Don't forget to check that you have permissions to connect to the hose where the postgis is and to create the database.