Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I receive a "schema does not exist" error when trying to load a raster to a PostGIS database (see full error at the bottom). The schema does exist in the database. This is the syntax I'm using:

raster2pgsql -s 2048 -I -C -Y C:\Users\My_Book\Desktop\LOAD2POSTGIS\Aspect.tif environmental.aspect > Aspect.sql
psql -h localhost -U postgres -d Howbill -f Aspect.sql

I am able to load the raster into the default public schema if I leave out environmental.aspect. However, that leads to other problems when moving the raster table from the public schema to another schema. More details regarding the moving from public schema to other schemas can be viewed here:

Can't view PostGIS rasters after changing schemas

**Full error:**

C:\Program Files (x86)\PostgreSQL\9.2\bin>raster2pgsql -s 2048 -I -C -Y C:\Users\My_Book\Desktop\LOAD2POSTGIS\Aspect.tif environmental.aspect > Aspect.sql
psql -h localhost -U postgres -d Howbill -f Aspect.sql
Processing 1/1: C:\Users\My_Book\LOAD2POSTGIS\Aspect.tif

C:\Program Files (x86)\PostgreSQL\9.2\bin>psql -h localhost -U postgres -d Howbi
ll -f Aspect.sql
BEGIN
psql:Aspect.sql:2: ERROR:  schema "environmental" does not exist
psql:Aspect.sql:3: ERROR:  current transaction is aborted, commands ignored unti
l end of transaction block
psql:Aspect.sql:5: invalid command \.
psql:Aspect.sql:6: ERROR:  syntax error at or near "010000010013"
LINE 1: 010000010013B444D4496B144013B444D4496B14C082F38736BB1CD94011...
        ^
psql:Aspect.sql:7: ERROR:  current transaction is aborted, commands ignored unti
l end of transaction block
ROLLBACK

C:\Program Files (x86)\PostgreSQL\9.2\bin> 
share|improve this question
    
Have you created new schema allready? Have you enabled PostGIS extensions in new schema ? Do that or change default search path "SET search_path TO public,myschema; –  simplexio Aug 7 '13 at 11:35
    
I created the new schema (in this case, environmet) before loading the raster. The postGIS extension is enabled and located in the public schema. This is my search_path "$user", public, topology, environmental; –  Thunderbolt Aug 7 '13 at 11:53
    
Is the schema called environment or environmental (as the error message writes)? –  Andre Joost Aug 7 '13 at 12:12
    
@Chris , my best quess is that you have a typo there like error message says "ERROR: schema "environmental" does not exist" . That search path should work if it same for raster2psql command –  simplexio Aug 8 '13 at 10:20
    
I created a test schema in the PostGIS database and was able to load a raster directly into the test schema using raster2pgsql. Going to delete the environmental schema and recreate it. hopefully this will work. Thanks for the input and advice. –  Thunderbolt Aug 9 '13 at 6:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.