How can I measure distance with tastypie and geodjango?

Posted by Twitch on Stack Overflow See other posts from Stack Overflow or by Twitch
Published on 2014-08-20T20:32:59Z Indexed on 2014/08/20 22:20 UTC
Read the original article Hit count: 160

Filed under:
|
|
|

Using Tastypie and GeoDjango, I'm trying to return results of buildings located within 1 mile of a point.

The TastyPie documentation states that distance lookups are not yet supported, but I am finding examples of people getting it work, such as this discussion and this discussion on StackOverflow, but no working code examples that can be applied.

The idea that I am trying to work with is if I append a GET command to the end of a URL, then nearby locations are returned, for example:

http://website.com/api/?format=json&building_point__distance_lte=[{"type": "Point", "coordinates": [153.09537, -27.52618]},{"type": "D", "m" : 1}]

But when I try that, all I get back is:

{"error": "Invalid resource lookup data provided (mismatched type)."}

I've been pouring over the Tastypie document for days now and just can't figure out how to implement this.

I'd provide more examples, but I know they'd be all terrible. All advice is appreciated, thank you!

© Stack Overflow or respective owner

Related posts about python

Related posts about django