I don't know if you're familiar with C# and the NGeoNames package but if you are:
If you need to do a single lookup:
Code:
using NGeoNames;
using System;
using System.IO;
using System.Linq;
class Program
{
static void Main(string[] args)
{
var datadir = @"d:\test\geo";
// Download file (optional; you can point a GeoFileReader to existing files ofcourse)
GeoFileDownloader.CreateGeoFileDownloader().DownloadFile("NL.zip", datadir);
// Lookup entry
var entry = GeoFileReader.ReadExtendedGeoNames(Path.Combine(datadir, "NL.txt"))
.Where(g => g.Id == 6544279)
.FirstOrDefault();
Console.WriteLine(entry.Name);
}
}
If you want to do lots of lookups in O(1):
Code:
using NGeoNames;
using System;
using System.IO;
using System.Linq;
class Program
{
static void Main(string[] args)
{
var datadir = @"d:\test\geo";
// Download file (optional; you can point a GeoFileReader to existing files ofcourse)
GeoFileDownloader.CreateGeoFileDownloader().DownloadFile("NL.zip", datadir);
// Build dictionary
var entries = GeoFileReader.ReadExtendedGeoNames(Path.Combine(datadir, "NL.txt"))
.ToDictionary(g => g.Id);
Console.WriteLine(entries[6544279].Name);
Console.WriteLine(entries[2759794].Name);
Console.WriteLine(entries[2745912].Name);
}
}