Using GeoNames web services for JSON list of locations

I found a nice web service that provides a JSON array of places based on a latitude and longitude. It is provided by GeoNames and has been very useful supplying locations for my Ruby on Rails app.

Place this URL in your browser or click the link:

http://api.geonames.org/citiesJSON?north=38.99&south=38.8&east=-77.4&west=-77.6&lang=en&username=demo&maxrows=10

Here is a sample JSON output for one location:

{ “geonames” : [ { “countrycode” : “US”,
        “fcl” : “P”,
        “fclName” : “city, village,…”,
        “fcode” : “PPL”,
        “fcodeName” : “populated place”,
        “geonameId” : 4751839,
        “lat” : 38.840390900000003,
        “lng” : -77.428876900000006,
        “name” : “Centreville”,
        “population” : 71135,
        “toponymName” : “Centreville”,
        “wikipedia” : “en.wikipedia.org/wiki/Centreville%2C_Virginia”
      } ] }

I also found a nice Rub Gem called geonames that provides a nice, easy to use module with classes.

Look here for more information on the GeoNames web service: http://www.geonames.org/export/JSON-webservices.html#citiesJSON.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s