Skip to main content
1 of 3
John Powell
  • 13.7k
  • 5
  • 48
  • 62

You can do all of this in one step, eg,

raster2pgsql -c -s 27700 -C -I -f rast *.asc -t 100x100 stg.COUNTRY_1M 
| psql -U treex -d data_processing -h localhost

-c means create, which is the default. Because you can use *.asc, there is no need to use

for i in $(ls *.asc); do raster2pgslq ...; done

type logic, as all asc files will be passed to raster2pgsql, and this will avoid the error you are seeing of trying to add tiles to a table that already has contraints on.

As as aside, from your previous question, I know that this is UK LIDAR, which is quite a large dataset. You would be well advised to use -t switch to tile you input. Something in the range of 100-200 pixels seems to work well.

John Powell
  • 13.7k
  • 5
  • 48
  • 62