flickrgeocodr

Flickr Geocodr - inspired by Mikel Marons's work
This version uses k-means clustering to geocode places based on peoples public photos!. There are two webservices:

http://geocodr.net/Flickr/flickrgeocodr.php
which can output as REST XML or JSON

http://geocodr.net/Flickr/flickrgeocodr_cluster.php
to output more detailed information regarding the clusters themselves in REST XML or JSON.

Example application

Documentation for webservice:
URL: http://geocodr.net/Flickr/flickrgeocodr.php?place=
You will need to create a query string. The only required key-value pair is "place", and it will use the other values on their default settings.
place = the placename to search for.
format= json|xml (default xml).
searchmode = tags|text (default tags) (text searchs tags, title and description).
sortmode = interestingness-desc|relevance|(or any other values from Flickr API)(default interestingness-desc).
bbox = any min_lon, min_lat, max_lon, max_lat Comma separated, no spaces. Good for limiting to continent / country.(default world -180.0,-90.0,180.0,90.0).
Tweaks
In addition to changing searchmode and sortmode, results may change and improve by changing the following:
numresults = 5 to 500 (default 50) Number of photo results to process from Flickr, more will slow things down, but may increase sample size, and accuracy.
numclusters = 2 to 20 (default 3) Number of clusters to use internally, experiment with this, I find 3 and 4 fine.

results:

<item>
<latitude>51.507715576923</latitude>
<longitude>-0.146583</longitude>
<place>london</place>
<error>1</error>
</item>

Cluster information in JSON (flickrgeocodr_cluster.php)
http://geocodr.net/Flickr/flickrgeocodr_cluster.php
You can use all the same GET values as above, but there are additional ones:
showpoints = true|false (defaults to false) Returns photos in each cluster (link to photo, and link url)
showclusters = true|false (defaults to true)
format = xml or json (default is xml)

Returned XML comes in three flavours, Just the largest cluster, all the clusters and all clusters with point information:


<clusters>
<cluster>
<type>cluster</type>
<id>0</id>
<pointcount>26</pointcount>
<latitude>51.507715576923</latitude>
<longitude>-0.146583</longitude>
<place>london</place>
<bbox>51.459134,-0.224028,51.543732,-0.122985</bbox>
</cluster>
<cluster>
<type>cluster</type>
<id>1</id>
<pointcount>6</pointcount>
<latitude>51.506104833333</latitude>
<longitude>-0.018274666666667</longitude>
<place>london</place>
<bbox>51.483895,-0.055709,51.527369,-0.001266</bbox>
</cluster> <cluster>
<type>cluster</type>
<id>2</id>
<pointcount>18</pointcount>
<latitude>51.506230722222</latitude>
<longitude>-0.098079611111111</longitude>
<place>london</place>
<bbox>51.421085,-0.119519,51.527963,-0.065188</bbox>
</cluster> <error>1</error>
</clusters> http://geocodr.net/Flickr/flickrgeocodr_cluster.php?place=london&format=xml&showpoints=true <clusters>
<cluster>
<type>cluster</type>
<id>0</id>
<pointcount>26</pointcount>
<latitude>51.507715576923</latitude>
<longitude>-0.146583</longitude>
<place>london</place>
<bbox>51.459134,-0.224028,51.543732,-0.122985</bbox>

<points>
<point>
<type>point</type>
<link>http://www.flickr.com/photos/33286810@N00/13317153</link>
<thumnail>
http://static.flickr.com/11/13317153_ca353f3462_t.jpg
</thumnail>
<latitude>51.50679</latitude>
<longitude>-0.142571</longitude>
</point>
<point>
<type>point</type>
<link>
http://www.flickr.com/photos/87677821@N00/147034740
</link>
<thumnail>
http://static.flickr.com/52/147034740_a53ad71e81_t.jpg
</thumnail>
<latitude>51.543732</latitude>
<longitude>-0.152735</longitude>
</point> . . .

Examples

Example application


Simple geocode query: Where is Yorkshire in the world?
http://geocodr.net/Flickr/flickrgeocodr.php?place=yorkshire

Longer query: Where is Southamption in the UK?
http://geocodr.net/Flickr/flickrgeocodr.php?place=southampton
&bbox=-8.66250,50.06250,2.58750,58.50000&searchmode=text&sortmode=relevance&numresults=100&numclusters=4

Tim Waters (Blog)