Login

Tag "location"

Snippet List

Closest ORM models to a latitude/longitude point

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
Read More

location context_processor

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/).

  • url
  • path
  • location
  • nav
Read More

Fire Eagle example: views.py from wikinear.com

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)

  • location
  • fireeagle
  • oauth
Read More

4 snippets posted so far.