Build Status

A node.js server used to get the biggest or the closest cities based on a given HTTP request.


CORS Requests

All responses from the GeonamesServer include required headers to be CORS compliant

JSONP Requests

The GeonamesServer supports JSONP requests. The callback parameter is callback.




          "score": 583087.56,
          "geonameid": 2988998,
          "name": "Oullins",
          "country": {
            "name": "France",
            "code": "FR"
          "timezone": "Europe/Paris",
          "feature": {
            "class": "P",
            "code": "PPL"
          "population": 25592,
          "location": {
            "latitude": 45.71774,
            "longitude": 4.80382
          "names": [
          "admin1Code": "B9",
          "admin2Code": 69,
          "admin3Code": 691,
          "admin4Code": 69149,
          "updatedOn": "2012-01-18",
          "region": {
            "code": "FR.B9",
            "name": "Rhône-Alpes"


The following is a list of available routes. All these routes can only be accessed through GET requests.

Any other methods will result in a 405 Method not allowed error.

The results will be sent with the application/json mimetype.

If the sort parameter is specified and set to closeness but the location of the request could not be determined (due to a lack of data within the GEOIP database or GEOIP module not being installed), the current sort will be replaced by the population sort.

If a mandatory parameter or unknown parameter value is detected the server will respond with a 400 Bad Request error.


Returns a quick documentation in HTML format.


Gets the list of all the cities in the database, limited to *maxresultper_page* results by default.

*maxresultper_page* is setted from configuration files or overridden with limit query parameter parameter up to 100.



Returns the city which geonameid value is equal to the given id.


Returns the city in which the given IP address is located

Accepted content types

GeonamesServer can return data formated in json.

Examples of response

Following are the results returned for the request */city?name=paris&limit=2


            "geonames": {
                "totalResultsCount": "2",
                "geoname": [
                        "score": 884.5834,
                        "geonameid": 2988507,
                        "name": "Paris",
                        "country": {
                            "name": "France",
                            "code": "FR"
                        "timezone": "Europe/Paris",
                        "feature": {
                            "class": "P",
                            "code": "PPLC"
                        "population": 2138551,
                        "location": {
                            "latitude": 48.85341,
                            "longitude": 2.3488
                        "names": [
                            "gorad paryzh",
                            "lungsod ng paris",
                            "lutetia parisorum",
                            "parizh osh",
                            "ba li",
                            "горад парыж",
                            "париж ош",
                        "admin1Code": "A8",
                        "admin2Code": 75,
                        "admin3Code": 751,
                        "admin4Code": 75056,
                        "updatedOn": "2012-08-19",
                        "region": {
                            "code": "FR.A8",
                            "name": "Île-de-France"
                        "score": 312.7515,
                        "geonameid": 4717560,
                        "name": "Paris",
                        "country": {
                            "name": "United States",
                            "code": "US"
                        "timezone": "America/Chicago",
                        "feature": {
                            "class": "P",
                            "code": "PPLA2"
                        "population": 25171,
                        "location": {
                            "latitude": 33.66094,
                            "longitude": -95.55551
                        "names": [
                            " tksas",
                            " tgzas",
                            "باريس، تكساس",
                            "پاریس، تگزاس"
                        "admin1Code": "TX",
                        "admin2Code": 277,
                        "admin3Code": "",
                        "admin4Code": "",
                        "updatedOn": "2011-05-14",
                        "region": {
                            "code": "US.TX",
                            "name": "Texas"