title: Reverse wikipedia geotagging lookup
body: <p>Wikipedia is <a href="http://en.wikipedia.org/wiki/Geotagging" rel="nofollow noreferrer">geotagging</a> a <a href="http://en.wikipedia.org/wiki/Aalborg" rel="nofollow noreferrer">lot</a> <a href="http://en.wikipedia.org/wiki/British_Isles" rel="nofollow noreferrer">of</a> <a href="http://en.wikipedia.org/wiki/Kent%27s_Cavern" rel="nofollow noreferrer">its</a> <a href="http://en.wikipedia.org/wiki/Aalborghus_Castle" rel="nofollow noreferrer">articles</a>. (Look in the top right corner of the page.)</p>
  
  <p>Is there any API for querying all <a href="http://en.wikipedia.org/wiki/Wikipedia:WikiProject_Geographical_coordinates" rel="nofollow noreferrer">geotagged pages</a> within a specified radius of a geographical position?</p>
  
  <h3>Update</h3>
  
  <p>Okay, so based on lost-theory's answer I tried this (on <a href="http://dbpedia.org/snorql/" rel="nofollow noreferrer">DBpedia query explorer</a>):</p>
  
  <pre><code>PREFIX geo: &lt;http://www.w3.org/2003/01/geo/wgs84_pos#&gt;
  SELECT ?subject ?label ?lat ?long WHERE {
      ?subject geo:lat ?lat.
      ?subject geo:long ?long.
      ?subject rdfs:label ?label.
      FILTER(xsd:float(?lat) - 57.03185 &lt;= 0.05 &amp;&amp; 57.03185 - xsd:float(?lat) &lt;= 0.05
          &amp;&amp; xsd:float(?long) - 9.94513 &lt;= 0.05 &amp;&amp; 9.94513 - xsd:float(?long) &lt;= 0.05
          &amp;&amp; lang(?label) = "en"
      ).
  } LIMIT 20
  </code></pre>
  
  <p>This is very close to what I want, except it returns results within a (<a href="http://en.wikipedia.org/wiki/Local_property" rel="nofollow noreferrer">local</a>) square around the point and not a circle. Also I would like if the results where sorted based on the distance from the point. (If possible.)</p>
  
  <h3>Update 2</h3>
  
  <p>I am trying to determine the euclidean distance as an approximation of the true distance, But I am having trouble on squaring a number in SPARQL. (<a href="https://stackoverflow.com/questions/1401401/power-in-sparql-and-other-math-functions">Question opened here</a>.) When I get something useful I will update the question, but in the meantime I will appreciate any suggestions on alternative approaches.</p>
  
  <h3>Update 3</h3>
  
  <p>A final update. I gave up on using SPARQL through DBpedia. I have written a simple parser which fetches the Wikipedia article text nightly database dump and parses all articles for geocodes. It works rather nicely and it allows me to store information about geotagged articles however I wish.</p>
  
  <p>This is probably the solution I will continue using, and if I get around to create a nice interface to it I might consider allowing public API access and/or publishing the source to the parser.</p>