I was able to create a Postgresql database and then I executed,
createlang plpgsql geospecies
psql -d geospecies -f postgis.sql
psql -d geospecies -f spatial_ref_sys.sql
So now can I directly import the shapefiles? Would this be the right command,
ogr2ogr -f PostgreSQL PG:"host=server_ip user=username dbname=dbname password=password" yourshapefile.shp;
I am not sure how to structure the database, would it not need a table? I will eventually need to add a bunch load of shapefiles and so is there a command to do that?
Answer
Try shp2pgsql
. The basic syntax is like:
shp2pgsql -s SRID SHAPEFILE.shp SCHEMA.TABLE | psql -h HOST -d DATABASE -U USER
I always find this cheatsheet from http://www.bostongis.com useful. If you scroll down a little, you will find simple examples on how to load data.
Hope it helps.
No comments:
Post a Comment