1

The general version of the question is above - a a little more detail, I am using Django Rest Framework, but am happy for answers to be dealing with the problem in abstract.

So, I have data with ~200 countries, ~10,000 regions (the countries subdivided) and ~600 extra small districts in the UK.

My plan is currently to have the client send a request, with its current zoomlevel and position, then on the server:

  1. filter objects to correct zoomlevel
  2. filter objects to ones that overlap with viewing rect
  3. insert "custom data" into the features before returning

Alternative plan for 3. is to pass back the "custom data" in a separate request.

A little more detail on what the custom data is - votes - there will be a large number of voteables, and even more votes, my plan here is to precalc/cache the vote totals for each question+area there is a vote in, to make returning the data as fast as possible.

Still, I'm not too sure of a sensible way to minimise the number of DB Queries - perhaps get the geo areas that match the view, and do one query to get all pre-calculated "custom data" that matches.

Any thoughts on a good way to deal with this kind of situation are very welcome. There may we be bits I have not thought of too much (like avoiding re-sending data more than needed if the user keeps scrolling around)

  • 1
    I've edited your question title to more accurately reflect what I believe you're actually asking. Feel free to correct it if it is inaccurate. Your original title was too broad. – Robert Harvey Jan 22 '16 at 15:13
  • This title seems equally valid, I was thinking "programmers" is the place to be slightly broad? while stack exchange is more about details? I'll go read the docs ;) – Chozabu Jan 22 '16 at 15:25
  • 1
  • @gnat: He's not asking about site scope. This is the usual "Programmers is for softer questions" misconception. – Robert Harvey Jan 22 '16 at 15:31
  • 1
    Thanks for the link - explained things better than the official docs :) – Chozabu Jan 22 '16 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.