Associate
- Joined
- 25 Aug 2008
- Posts
- 947
Hi,
I am creating a site that uses location data. The easiest way to make it consistant around the globe would be by the use of lat/long details - but I would like to incorporate a worldwide postcode format if possible as well.
I will try to raise my concern as an example(not related to my site).
Lets say my mobile gives the site my lat/lon details, and I want to know all the indian takeaways in a 1km radius.
I could setup a calculation in my SQL statement to pull back results, but thats a lot of calculations - especially if the database has thousands of entries.
So to speed this up, I could for example create a box around my location 2km by 2km. That way I could say if a<lattitude<b and c<longitude<d then display results. Results not so accurate, but that should prove a faster search right? With a lot of users this would still slow the server - so could I make this faster again?
Accuracy is not so much my concern here.
My only thought of making this any faster, would be to 'grid' up the globe, on a variety of scales. I could then say my current location is in grid box A, I want to search a distance of Y, so my search results should return all entries in grid boxes ....
Does this seem feesible? To speed things up, I think I could have a database that stores say grid box A, and then has a subset of grid boxes to include, based on a search of distances 1k/5k/10k/25k/50k and so on.
Would this be faster, and require less use of the server? The onlything I am not sure about then would be the space required in the database.
I am creating a site that uses location data. The easiest way to make it consistant around the globe would be by the use of lat/long details - but I would like to incorporate a worldwide postcode format if possible as well.
I will try to raise my concern as an example(not related to my site).
Lets say my mobile gives the site my lat/lon details, and I want to know all the indian takeaways in a 1km radius.
I could setup a calculation in my SQL statement to pull back results, but thats a lot of calculations - especially if the database has thousands of entries.
So to speed this up, I could for example create a box around my location 2km by 2km. That way I could say if a<lattitude<b and c<longitude<d then display results. Results not so accurate, but that should prove a faster search right? With a lot of users this would still slow the server - so could I make this faster again?
Accuracy is not so much my concern here.
My only thought of making this any faster, would be to 'grid' up the globe, on a variety of scales. I could then say my current location is in grid box A, I want to search a distance of Y, so my search results should return all entries in grid boxes ....
Does this seem feesible? To speed things up, I think I could have a database that stores say grid box A, and then has a subset of grid boxes to include, based on a search of distances 1k/5k/10k/25k/50k and so on.
Would this be faster, and require less use of the server? The onlything I am not sure about then would be the space required in the database.