Done earlier with PHP using an SQL query - SELECT item_id, title, category, price, city, date, gpslat, gpslong, 3956 * 2 *
ASIN(SQRT( POWER(SIN(($origLat - abs(gpslat))*pi()/180/2),2)
+COS($origLat*pi()/180 )*COS(abs(gpslat)*pi()/180)
*POWER(SIN(($origLon-gpslong)*pi()/180/2),2)))
as distance FROM $tableName WHERE
gpslong between ($origLon-$dist/abs(cos(radians($origLat))*69))
and ($origLon+$dist/abs(cos(radians($origLat))*69))
and gpslat between ($origLat-($dist/69))
and ($origLat+($dist/69))
having distance < $dist ORDER BY distance limit 30;
Can do it for you in Python/PHP as you like.