2

I'm looking for an API that returns which language is spoken in country of the given coordinates. Does anyone know if something like that exists?

Kara
  • 6,115
  • 16
  • 50
  • 57
Jelle
  • 284
  • 3
  • 13
  • Coordinate to country lookup use this answer: http://stackoverflow.com/a/3666861/317706 Language(s) spoken in the country: http://stackoverflow.com/a/1876170/317706 – user317706 Jun 03 '12 at 10:08

1 Answers1

0

ws.geonames.org provides this service. Here is some sample code using JavaScript and jQuery, but you can access it with any language:

var lookupLanguagesWithGeonames = function(lat, lng) {

    $.getJSON('http://ws.geonames.org/countryCode', {
        lat: lat,
        lng: lng,
        type: 'JSON'
    }, function(results) {
        if (results.countryCode) {
            alert('coordinates: ' + lat + ', ' + lng + '\n' + 'languages: ' + results.languages);
        } else {
            alert('coordinates: ' + lat + ', ' + lng + '\n' + 'failed: ' + results.status.value + ' ' + results.status.message);
        }
    });
};

// Coordinates that fall within a country
lookupLanguagesWithGeonames(43.7534932, 28.5743187);

// Coordinates which are not within any country
lookupLanguagesWithGeonames(142, 124);​

jsfiddle link

hippietrail
  • 15,848
  • 18
  • 99
  • 158