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.

We want to store data from shape files in PostGIS all in one table.

There will be two columns in the table:

  • boundary - The polygon data (How do we store this?)
  • mongo_id - Links to a mongo database

It seems if we use shp2postgis it creates a whole set of tables for that shape file. We want to use one table for all boundary data.

What is the best way to do this? (Do we need to use a specific srid?)

share|improve this question

2 Answers 2

up vote 0 down vote accepted

Probably you are seeing the postgis metadata tables, which contain things such as projection information, and information about any geometry columns in tables, and what projection they are in. If you posted the names of the tables you have that might help. Each shapefile should create one table with a geometry column, with all your other data.

Also bear in mind that PostGIS needs a unique ID column in the table, so you will need more than two columns.

You are free to create as many geometry columns in each table as you like -- for instance you could create the centroid of a polygon object in the same table -- but this must be done using PostGIS functions not using shp2postgis.

share|improve this answer
    
What I am trying to do is this: 1. Create one table where I can have a polygon and mongo_id 2. The metadata for the shape is stored in mongo but the actual shape is stored in postgres, but the information about the shape is in mongo. The only problem is, if I get shapes that have different srid's will I have problems if I store them in the same table? –  Chris Muench Mar 26 '12 at 16:15
    
how can it be in a different projection if it's from the same shp file? –  Stev_k Mar 26 '12 at 16:19
    
They are different shape files –  Chris Muench Mar 26 '12 at 16:22
    
I want to have one table where I can use multiple shape files –  Chris Muench Mar 26 '12 at 16:22
    
well, that's possible, but don't think you'll be able to use shp2postgis. You'll probably have to load additional shapefiles in manually unless anyone else knows a suitable tool. If you manage that I would probably store all information in the table in one standard projection, then transform individual records on the fly if you need to. –  Stev_k Mar 26 '12 at 16:26

I am assuming that by shp2postgis you actually mean shp2pgsql. If so, then the -a option will append your data into an existing table rather than replacing the data.

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.