In a map application i display markers on a map based on the visible map area using a query similar to the following.
SELECT * FROM (`properties`)
WHERE `lat` > '-11.824448' AND `lat` < '84.124002' AND
`lng` > '-152.243398' AND `lng` < '-39.743398'
LIMIT 20;
Due to the index on the table this results in results appearing usually on the same latitude and appear on a line in the corner of the map. wit the rest of the map being empty.
Given that i can't display all the results on the map due to server load, bandwidth and load time, is there a way i can pull back results across the entire map area?
I guess i could do this by figuring out a proportional distance of x and telling mysql to return results where no result is within x distance of another.
How do other people do it?