Hi Jacobo,
I hope you don't mind that I share the answer with the list. I think the
answer to this question might be of general interest.
the JavaScript creating the visualization in the browser is here:
<https://dl.dropboxusercontent.com/u/172199972/map/map.js
As you can see it is just a simple usage of HTML5 canvas.
It requires two data files as these (careful, large):
<https://dl.dropboxusercontent.com/u/172199972/map/wdlabel.js
<https://dl.dropboxusercontent.com/u/172199972/map/graph.js
The first contains all items, their latlong, and their label.
The second contains the graph, the way items are connected to each other.
The latter two files are created by the following Python scripts, in two
steps. First, you need to create the knowledge base. This can be done with
the following scripts:
<https://github.com/mkroetzsch/wda
Use there the script
<
https://github.com/mkroetzsch/wda/blob/master/wda-analyze-edits-and-write-k…
Careful when you run it, it will download all Wikidata dumps. This might
need a few free Gigabyte and a decent internet connection.
Now, you should have the file kb.txt.gz, containing the knowledge base.
By the way, you can also download the knowledge base as it is created
nightly by us here:
<https://dl.dropboxusercontent.com/u/172199972/kb.txt.gz
Finally, you will need a few scripts from here:
<https://github.com/vrandezo/wikidata-analytics
Run them in the following order:
geolabel.py - extracts a list of all locations and their label from the
knowledge base <
https://github.com/vrandezo/wikidata-analytics/blob/master/geolabel.py
geolabel2wdlabel.py - transforms the list to
JavaScript for ready
consumption by the Wikidata Map Interface <
https://github.com/vrandezo/wikidata-analytics/blob/master/geolabel2wdlabel…
geo.py - extract a list of all locations from
the knowledge base <
https://github.com/vrandezo/wikidata-analytics/blob/master/geo.py
graph.py - extracts the simple knowledge graph
from the knowledge base <
https://github.com/vrandezo/wikidata-analytics/blob/master/graph.py
geograph.py - extracts the part of the simple
knowledge graph that connects
geographical items with each other (needs geo and graph) <
https://github.com/vrandezo/wikidata-analytics/blob/master/geograph.py
geograph2geojs.py - transforms the geograph to
JavaScript for ready
consumption by the Wikidata Map Interface <
https://github.com/vrandezo/wikidata-analytics/blob/master/geograph2geojs.py
This should you give the two files wdlabel.js and graph.js, which will be
called by the Wikidata Map Interface (see it's HTML source in order to see
how).
This process is run nightly on a machine we have standing here in the
office. I am planning to set this up on labs, but didn't find the time yet.
I hope this helps,
Denny
2013/7/29 Jacobo Nájera <jacobo(a)metahumano.org
> Hi Denny,
> I am interested in Wikidata Map Interface,
Where can i see and download
> the code? I want to experiment and document with it.
> Thanks,
> Jacobo
> --
> Wikimedia México
--
Project director Wikidata
Wikimedia Deutschland e.V. | Obentrautstr. 72 | 10963 Berlin
Tel. +49-30-219 158 26-0 |
http://wikimedia.de
Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e.V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg unter
der Nummer 23855 B. Als gemeinnützig anerkannt durch das Finanzamt für
Körperschaften I Berlin, Steuernummer 27/681/51985.