Package org.wikidata.wdtk.examples
Class WorldMapProcessor
java.lang.Object
org.wikidata.wdtk.examples.WorldMapProcessor
- All Implemented Interfaces:
EntityDocumentProcessor
This example class processes EntityDocuments to create a map image that shows
the distribution of items with geographic coordinates on Earth. Several maps
are generated, for Wikidata as a whole and for several big Wikipedias.
The size of the images, the projects that are included, and the brightness of the maps can be modified in the main method.
- Author:
- Markus Kroetzsch
-
Constructor Summary
ConstructorDescriptionWorldMapProcessor
(int width, double brightness) Creates a new processor for building world maps. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Registers a new site for specific data collection.static void
Main method.static void
Prints some basic documentation about this program.void
processItemDocument
(ItemDocument itemDocument) Processes the given ItemDocument.void
Sets the globe on which coordinates should be gathered.void
Writes all collected data to files after processing is finished.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.wikidata.wdtk.datamodel.interfaces.EntityDocumentProcessor
processEntityRedirectDocument, processLexemeDocument, processMediaInfoDocument, processPropertyDocument
-
Constructor Details
-
WorldMapProcessor
public WorldMapProcessor(int width, double brightness) Creates a new processor for building world maps.- Parameters:
width
- horizontal size of the world map; the map's height is half of this (plus some pixels for printing the scale)brightness
- parameter for scaling up the brightness of colors; the default is 1.0; higher values make smaller numbers appear more brightly; smaller numbers darken smaller numbers and thus help to highlight the biggest concentrations of items
-
-
Method Details
-
main
Main method. Processes the whole dump using this processor and writes the results to a file. To change which dump file to use and whether to run in offline mode, modify the settings inExampleHelpers
.- Parameters:
args
-
-
addSite
Registers a new site for specific data collection. If null is used as a site key, then all data is collected.- Parameters:
siteKey
- the site to collect geo data for
-
setGlobe
Sets the globe on which coordinates should be gathered. This should be an entity URI, e.g.,GlobeCoordinatesValue.GLOBE_EARTH
.- Parameters:
globe
-
-
processItemDocument
Description copied from interface:EntityDocumentProcessor
Processes the given ItemDocument.- Specified by:
processItemDocument
in interfaceEntityDocumentProcessor
- Parameters:
itemDocument
- the ItemDocument
-
writeFinalData
public void writeFinalData()Writes all collected data to files after processing is finished. -
printDocumentation
public static void printDocumentation()Prints some basic documentation about this program.
-