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 am new to PostgreSQL and PostGIS.

Recently, I created a PostGIS 2.0.3 database on a PostgreSQL 9.1 database server using pgAdmin. The "PostGIS" extension was found installed in "Extensions". Al spatial functions were added to the "public" schema. That's fine.

Now I want to store all my data into a new scheme called "gc". However, how can I make all spatial function installed in that "gc" schema? There is no single function in the schema. However, when I tried to import/new a feature class from ESRI ArcCatalog 10.1 to this schema, it worked! The feature class could be imported and displayed in QGIS.

Could anyone give me any tip or idea about it?

Thanks in advance!

share|improve this question
    
Just noticed: already dealt with at gis.stackexchange.com/questions/43187/… –  martin f Feb 21 at 3:47

1 Answer 1

up vote 5 down vote accepted

When you spatially-enable a PostGIS database, the relevant functions, SRS table, and views are placed in the public schema, as you state. That does not mean that all or any of your own spatial tables need to be in the same public schema. PostGIS will still work on all spatial data in the "new" schemas.

In fact, I usually place my application-specific tables in a separate schema. That way, if you need to do a major version upgrade to PostGIS, you can keep your application-specific table backups and restores as a separate procedure from the one that replaces the spatial tools.

So, I think you're doing well. Finally, in case you didn't do it already, it's a good idea to add the new schema to the search path:

ALTER DATABASE my_db SET search_path = gc, public;

share|improve this answer
    
Thanks Martin. Does it mean I am able to use spatial functions on tables in a custom schema other than "public"? –  alextc Feb 21 at 3:38

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.