Im using geodjango (postgis) to retrieve points contained inside a bounding box (made by leafletjs), it works so nice, but now I want to cache this query.
A tipical query is one like this:
/points?xmax=193.0078125&xmin=-200.7421875&ymax=49.83798245308484&ymin=29.53522956294848
This kind of query will never be cached, is there a way to cache this?, I mean, achieve some cache hits, assuming would appear more/less points in the viewport than would strictly correspond. Some ideas...
- removing decimal position in the numbers
- passing zoomlevel as a param should be better/mandatory?
Thanks for your thoughts.
Solved:
Use https://pypi.python.org/pypi/django-geojson to make a simple view which uses (x,y,z) as params to do filter your queryset.
Use http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Tile_numbers_to_lon..2Flat._5 to make the filter in the view
- Use https://github.com/glenrobertson/leaflet-tilelayer-geojson/ for making a layer in you map which makes your tile request to the previous view.