A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.
I m trying to build an online geolocating sytem and we are trying to do this in python + postgres. Since this might endup being huge loads i dont want to rely on geocoder::us and the similar apis
I have found geopy and postgresql + postgis
and the zipdby library for zipcode search
any ideas on how to do proximity search based on locations and how to implement.
Should I use POSTGIS or try to hack it together with db..
What columns should the db api have thanks a lot
Saturday, February 10, 2007
For short distances, you can consider latitude and longitude to be rectangular and the math gets real easy. For more than a hundred miles or so, distance calulations will involve a bit of trig to compensate for the fact that the earth is nearly round. Look here for a typical example:
Let's say you have a list of gas stations with latitude and longitude and you want to find the ones that are within 5 miles from a certain point.
I would do it in two steps:
1. Get a short list of stations based on their latitude/longitude. To make it fast you or your database needs R*trees;
2. Refine the list by calculating the great circle distances for each station and excluding the ones that are more than 5 miles away.
This way it's going to be reasonably fast, as you won't need to do the trig for the gas stations in Alaska when you're in Florida.
> I m trying to build an online geolocating sytem [...] this might endup being huge loads [...] any ideas on how to do proximity search based on locations and how to implement.
I appreciate that this is going to sound quite harsh (not that I care if that upsets anyone), but shouldn't you actually know how to do things like that if you're already planning to build a product that you expect to have significant numbers of users?
It sounds like a few good books and some study would help more than just one answer to one question.
And without a whole lot more detail as to exactly what you're going to do, I can only make one guarantee: any answer that says "do it this way" is more likely than not going to be somewhere between inappropriate and entirely wrong. Seriously, you haven't given nearly enough detail to allow anyone to give you an intelligent design for your product.
Monday, February 12, 2007
This topic is archived. No further replies will be accepted.Other recent topics
Powered by FogBugz