[Zope-DB] Zip-Distances: MySQL or ZopeDB?

Matthew T. Kromer matt at bane.mi.org
Tue Oct 19 06:46:22 EDT 2004


When trying to do geographic distance calculations, try to find a 
database engine that specifically supports this by being able to do 
searching based on proximity to a particular latitude and longitude.   
Many commercial database packages offer something like this.   Trying 
to pre-compute zip codes would be terribly awkward.

If you didn't care too much about accuracy, I would think you could use 
a zip->location mapping table to find the center position, and compute 
the bounding box for that, then using those corner positions do a range 
search in the zip table to get all of the zip codes in that bounding 
box, then search your user database for all of those zip codes.

Its unlikely that anyone would notice that your distances would be 
computed based on the surrounding square rather than the surrounding 
circle.

On Oct 19, 2004, at 6:16 AM, Gregor Melhorn wrote:

> Hello everyone,
>
>  
>
> I am rather new to zope, maybe you could help me with the following 
> problem:
>
>  
>
> I’m planning to do a dating community site in zope, with about  50 000 
> members and up to 10 000 members being logged in at the same time. 
> Search function is only for members, so it needs to be authenticated. 
> Searching for other people is based on distance (search for all people 
> in 50 km distance etc.), and I also have a database with geodata for 
> all zip-codes.
>
>   
>
> So now there’s the problem: The search function of the site will be 
> used very often, and every different zip-code-query will of course 
> generate different results. Also a new registered user will again 
> generate different results. Searching is subclassed in different 
> distances (“up to 50 km”, “up to 100 km” and so on...).
>
>   
>
> Regarding performance, I thought of creating a large lookup-table in 
> mysql with all distances of all zip’s to all the other zips and 
> building an according select query for the user-list. On the other 
> hand – outsorcing the user (and therefore authentication data) will 
> slow down the site, since nearly everything on site needs to be 
> authenticated, won’t it?
>
>   
>
> Maybe there’s some combined solution to this problem – any ideas? I’m 
> really rather new to Zope, help would be really appreciated.
>
>  
>
> Regards
>
>  
>
> Gregor Melhorn
>
>  
>
>  
> _______________________________________________
> Zope-DB mailing list
> Zope-DB at zope.org
> http://mail.zope.org/mailman/listinfo/zope-db



More information about the Zope-DB mailing list