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.

Objective:

Need to store and retrieve a list of geometries from the database. Basically these are drawn by the user using OpenLayers which I would like to save and present again as a list (kind of like a recent history). When user clicks on a certain item on the list then that feature is drawn on the layer.

My way of going about it:

With my existing code, I would like to construct the feature from the geometry using OpenLayers ie., each of the geometries are sent to the client(as coordinates sets understood by OpenLayers) via AJAX when the client page loads. I don't want to have a layer and display these via GeoServer.

Question:

With the above in mind, does it matter how I store the geometries in the backend (Postgres with PostGIS)? If yes, which is better, storing the geometries as GEOMETRY column or just as normal strings(ie., varchar)?

share|improve this question
    
You question is little uncleared for me. I am using the Geometry column for better functionality . Check for more details postgis.refractions.net/documentation/manual-1.3.4rc2/ch06.html –  Sunil Feb 20 '13 at 7:13
1  
I am asking in terms of database storage,performance etc. For my use case, I have no need of any Postgis functionality on the stored geometries. But if storing as GEOMETRY datatype would result in lesser space(of course I would have to use St_AsText to retrieve them for using with OpenLayers) I could use that OR go ahead and store them as just normal text strings. –  Siva Feb 20 '13 at 7:48
4  
Geometry with a spatial index is going to be the best solution. –  Mapperz Feb 20 '13 at 14:11
    
@Mapperz thank you. I have proceeded with the same. I suppose the AddGeometryColumn command adds a spatial index by itself? –  Siva Feb 21 '13 at 9:51

1 Answer 1

  1. Probably after your requirements get complicated, it is best to think of making a scalable application.
  2. The advantage of working with a geometric column is the index, plus you can also work with wkt, GeoJSON and other standards that openlayers postgis and handle very well, so you would simplify the development
  3. Here you can find a good tutorial
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.