GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Get location description using geonameId  XML
Forum Index -> General
Author Message
sujithm



Joined: 07/10/2014 09:27:02
Messages: 1
Offline

Hi

Is there a way to get a short description about a location by providing geonameId? I found that there are APIs like "findNearbyWikipedia", "wikipediaSearch" and "wikipediaBoundingBox" which can be used to get location descriptions, but all of these accept latitude and longitudes. I am looking for a way to get accurate information pertaining to a specific location (represented by its geonameId).

Can you please let me know whether this is possible?

Thanks in advance.
RobIII


[Avatar]
Joined: 25/06/2014 03:05:47
Messages: 27
Location: Netherlands
Offline

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);
     }
 }
 
[WWW]
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team