Snippet List
Here's how to find the 10 closest locations to a point for a model that has latitude and longitude columns, if you're not using GeoDjango.
This runs a brute force distance calculation against every row, so it should only be used on smaller tables - probably less than 100,000 rows.
For larger tables you should use GeoDjango instead.
See also [my TIL](https://til.simonwillison.net/postgresql/closest-locations-to-a-point) about this.
- orm
- gis
- latitude
- longitude
- location
A simple context_processor to include location info. Useful for permalinks, site name references, and navigation bars. For example:
{% if location.path|match:"/$" %} class="current"{% endif %}
See also my [match filter](/snippets/1686/).
The views.py used by [wikinear.com](http://wikinear.com/) - see [http://simonwillison.net/2008/Mar/22/wikinear/](http://simonwillison.net/2008/Mar/22/wikinear/)
For a more comprehensive API wrapper for Fire Eagle, take a look at [fireeagle_api.py](http://github.com/SteveMarshall/fire-eagle-python-binding/tree/master/fireeagle_api.py)
4 snippets posted so far.