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 using Postgis as my backend for my project along with geoserver and openlayers. I have a table in my DB which gets filled up very frequently. Now when a user gets connected to a server , he can see the map with all the markers whose points are in the DB. Imagine the table keeps on filling up and there is no relation between user viewing the map and tables getting filled by values. Now suppose after some time when user clicks on certain button on the page, he has to see the map with markers of all the values present in the DB(along with new points inserted in the table since last time he clicked that button). This task can be made simple by making that button as submit button, but when the user clicks it, it reads the entire DB again(reloads the page) along with old points and projects on the map, instead of reading only the new points. This method is not at all good when I have 10000 points already in DB and only say 5 points getting added in the meantime. In this case it reads all the 10005 points instead of only 5 points.

So can anybody give me a solution on how to retrieve only the new points, still projecting all the points present in DB. To my knowledge Ajax can be used to do the same(which doesnt need reloading of the page) but I want a clear explanation of how to carry this work using postgis and geoserver. Are there any special functions which can handle this?? If not, what is the better way to do this?

Thanking you in advance.

share|improve this question
7  
Stop posting again and again the same question. We already reply to it. See the following post : gis.stackexchange.com/questions/7642/… –  simo Apr 10 '11 at 8:22

1 Answer 1

up vote 4 down vote accepted

If you store the results in a dict in Javascript with the primary key from the DB as the key you could easily do this. When you request the features just check to see if the newly fetched primary key exists in the dictionary and if it does don't do anything with it and if it doesn't then add it. The problem with this approach is requesting all that data might be slow and redundant

My approach would be to

  1. put a timestamp in the db
  2. query with timestamp and sort on timestamp ascending
  3. your last item will have the most recent timestamp - store that value separately
  4. for new query just query for timestamp values greater than the most recent from the last query
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.