I have a large dataset in a PostGIS database. I am viewing it via a web interface that loads the data as GeoJSON. There is too much data to give the client all at once (10s of MBs worth...) so I would like to get an area of data within the bounding box formed by the edges of the window (the dotted line in the image below). Getting the coordinates for points f and g is easy.
Question 1: Is this a good way of doing things? Should I be thinking of caching them as tiles or is this method likely to be efficient enough?
Question 2: How do I retrieve just the data within this bounding box?
Question 3: If a shape overlaps the edge of the bounding box (e.g. shape A below) is there a simple way to crop it as it is queried like in the second image?