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.

Situation:

I have a postgis vector lay that has lots of line segments (the features). I want to create a set of new layers each of which contains a subset of the features of the original layer and have these layers also stored back in postgis. Ideally with the actual features stored just once.

The only way I can see to create a new layer as opposed to load one from some source is via Layer->new which gives an option of shapefile or spatialite.

Choosing shape file I first tried to specify gid and fid attributes for the new layer but SPIT complains about duplicate field gid when I try to load it into postgis.

If I do not create any attributes for the new layer SPIT happily loads it, presumably duplicating all the features.

I am guessing this is a 'feature' rather than an oversight because if it were possible to share features between layers then then what would happen if a feature were split? If things were to work properly then all layers with referenced that feature would need updating with the new gid of the new portion.

Is this interpretation correct?

Russell

share|improve this question
1  
There is no such thing as a shared feature. You just have two copies, split one and the other stays the same. –  Nathan W Mar 10 '13 at 4:20
    
I figured that was probably the case. My problem is that over the years I have been thoroughly indoctrinated with the relational model and data normalisation ;) –  Russell Fulton Mar 11 '13 at 6:29
add comment

1 Answer

up vote 2 down vote accepted

Using PostGIS Manager plugin, you can create new tables in a PostGIS database.

You can also execute SQL statements such as

CREATE TABLE new_table AS SELECT * FROM old_table

to duplicate a table.

share|improve this answer
add comment

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.