|
Posted by shimmyshack on 03/15/07 10:33
On 15 Mar, 07:40, Roman <m...@dipmicro.com> wrote:
> xhe wrote:
> > I am now developing a website which needs Canadian PostCode Database.
> > I can certainly buy one, but that will cost my hundered of $$, and my
> > website is only for education purpose, it won't make money. So I am
> > afraid I can not affort it.
> > Are there any good friends who can share me with you Canadian PostCode
> > database, I need the longitude and latitude included in the DB.
> > Thank you very very much in advance.
> > If you still have other country's postcode DB which includes longitude
> > and latitude, can you please also show me? Thanks again for help.
> > Frank
>
> Can you query CanadaPost ? It gives you 16kb of HTML you have to parse
> information out of.
If you are lucky one of the ways will be a GET request with
pcode=blah, which will return html with links of the form
http://server.com/church_overlay?lat=52&lon=-12 or whatever, so find a
page that effectively offers URLs within the markup that use lat and
lon equicalent to your post code, then parse the marup for all urls,
and grab the one which has lat and lon in the query string.
This is fast and doesnt depend on the way the page is organised (or
reorganised) just on the presense of the URLs. Have this as a fall
back if the postcode cannot be found via other means, (it wont be
quite fast enough for prod use) update your db with the data for next
time, and gradually add "providers" in this way. This gets round the
use of an old database, updates tend to be new additions, more than
replacements, so an old db is useful and when you receive a request
for a postcode you dont have even an approximation for, the extra hit
of 1 second or so is probably worth it rather than sending "unknown"
back.
If anyone's interested and mails me I have a 42k place name sql table
for the UK, and a list of the first part of the uk postal codes I've
been using since mid '04. This would be useful for general distance
calcs - in the UK, 42k is all it takes to pretty much get the tiniest
settlement.
Navigation:
[Reply to this message]
|