Stuff near you in wikipedia

2008-08-27

A while back I blogged about querying dbpedia with sparql. The queries in that blog were pretty simple. Today, I present a more complicated example.

SELECT ?a, ?long, ?lat WHERE {
  <http://dbpedia.org/resource/Borne%2C_Overijssel> <http://www.w3.org/2003/01/geo/wgs84_pos#long> ?centerlong ;
                                                    <http://www.w3.org/2003/01/geo/wgs84_pos#lat>  ?centerlat .
  ?a <http://www.w3.org/2003/01/geo/wgs84_pos#long> ?long ;
     <http://www.w3.org/2003/01/geo/wgs84_pos#lat>  ?lat .
  FILTER ( -(?long - ?centerlong)*(?long - ?centerlong) - (?lat - ?centerlat)*(?lat - ?centerlat) > -0.01 )
}

This query gives you all items in the english Wikipedia near where I live.

You could also look for stuff near Gran Canaria or Berlin.

Comments

Post a comment