Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting shapefiles using shp2pgsql

I know where shp2pgsql is in the postgresql directory but I'm not sure what commands to use after that. I've read the manual thoroughly, and I am aware of all the arguments and options for the shp2pgsql command. I get the error:

-bash: shp2pgsql: command not found

Is it a permissions problem perhaps?

like image 495
John Avatar asked Dec 21 '22 11:12

John


1 Answers

The right command is «shp2pgsql», you have got a typo.

Usage example :

# shp2pgsql -c -D -s 4269 -I shaperoads.shp myschema.roadstable > roads.sql
# psql -d roadsdb -f roads.sql
  • -c creates the table
  • -I creates an index on geometry
  • -D uses dump format
  • -s specify projection srid

You first generate a sql file, which you then load into your database.

like image 93
Vincent Avatar answered Dec 30 '22 22:12

Vincent