Thursday, December 4, 2008

Windows Media Publishing point with geolocation

I wanted to write article about it, but this one, very recent is soo good, I don't have anything to add.

From newsgroups:

We've used the HostIP lookup before http://www.hostip.info/ which
you're encouraged to grab the database monthly using rsync and parse
it into the database format you use there.

They offer CSV, Postgres and MySQL downloads, though I've converted to
SQLite for our application. You might use SQL Server for example, by
parsing the CSV files in an an application update scheduled monthly -
the IP blocks only change location very rarely.

The data quality is more than adequate for your intended use.

Rsync is used to minimise the load on their freely provided data
sources (as well as your own download time and network resources), and
ensures only modifed data is copied after the initial sync.

If you choose to use their web API, please be sure to contribute a
cash donation appropriate to your usage level.

Maxmind offer a "lite" open source version of their database, which
includes a C# class you could modify : see

http://www.maxmind.com/app/api and
http://www.maxmind.com/app/geoip_country

The data has been more closely verified from alternate sources and is
appropriate for geolocation where it really matters.

In both cases what you're likely to have is an IP address lookup from
A.B.C.D which does primary lookup on a table referenced to IP.A, and
which contains rows with the B.C component.

Localisation is unnecessary to the D component of the IP address.

I preferred the A table structure (256 tables ip_0, ip_1, ...) because
in MySQL case, it will load the table into memory on first use. This
data will be cached into the user session, and won't be accessed
frequently once the user has connected, so more but smaller tables are
more efficient for MySQL.

Other table structures might be a single large table, depending on
which is best handled by your database, and contains indexes on rows
for A.B or A.B.C parts of the address.

Typical data size can be from 250-500MB on disk. For transport or
distribition, this can usually be 7-zipped to around 25-30MB.

HTH
Cheers - Neil
------------------------------------------------
Digital Media MVP : 2004-2008
http://mvp.support.microsoft.com/mvpfaqs