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 want to copy a Postgis or Spatialite DB sctructure (features, tables) to a blank DB. In ArcGIS i can easily handle it by using XML Workspace Document. Fisrtly extact it from a Geodatabase and than import it to blank/empty/new whatever you say. By the way the stucture of first DB copied to second DB (without data). Features (point, line, polygon etc), tables comes with this XML document. So how can i do this for Postgis or Spatialite DBs (opensource dbs). (I dont want data just structure.)

share|improve this question
    
Are you copying a generic PostGIS database structure, or one that uses ArcSDE/ArcServer to manage data? –  RyanDalton Mar 15 '13 at 16:03
    
Yea i wanna copy DB structure and i am not using ArcSDE. –  mete7 Mar 17 '13 at 17:51

3 Answers 3

In spatialite, you could just make a copy of the sqlite file, then open it up, and drop all data from all tables. (and run vacuum full afterwards)

share|improve this answer
    
Thank you, it looks like a solution but a little bit primitive solution. –  mete7 Mar 14 '13 at 21:51

For Postgres use pg_dump whith appropriate options (notably --only-schema) to dump the database structure. See http://www.postgresql.org/docs/8.4/static/app-pgdump.html for documentation.

pg_dump writes a dump file which can be transferred to whatever computer you want and then be read back in with psql and it's -f switch.

share|improve this answer
    
Thanks, nice idea i will try it as soon as... –  mete7 Mar 14 '13 at 21:52

For sqlite/spatialite you may want to try

SELECT sql FROM sqlite_master;

and redirect the output to a sql-script (text) file. Afterwards you can run the script to create a new database.

I have not tried it, though

share|improve this answer

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.