<script src="http://www.google.com/jsapi"></script>
<script>google.load("jquery", "1");</script>
<ul id="wikipedia"></ul>
<script type="text/javascript">
function geo_response(data){
var ul = $("#wikipedia");
for (var i = 0, item; item = data.geonames[i++];)
ul.append($("<li/>").append($("<a/>").attr("href", "http://" + item.wikipediaUrl).text(item.title).attr("title", item.summary)));
}
var geo = { lat: 51.500789, lng: -0.142264 };
$.getJSON("http://ws.geonames.org/findNearbyWikipediaJSON?callback=?", { lat: geo.lat, lng: geo.lng, maxRows: 10, country: "uk", radius: 10 }, geo_response);
</script>
GeoNames NearbyWikipedia API
There's an extra section at the bottom of my bus stops prototype that shows places near to the requested location, with links to their Wikipedia pages.
I'd found this very useful in Locly, and it turns out it's easy to do — given a latitude and longitude — using GeoNames' findNearbyWikipediaJSON web service:
Comments