Class WorldMapProcessor

java.lang.Object
org.wikidata.wdtk.examples.WorldMapProcessor
All Implemented Interfaces:
EntityDocumentProcessor

public class WorldMapProcessor extends Object implements 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 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

      public static void main(String[] args)
      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 in ExampleHelpers.
      Parameters:
      args -
    • addSite

      public void addSite(String siteKey)
      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

      public void setGlobe(String globe)
      Sets the globe on which coordinates should be gathered. This should be an entity URI, e.g., GlobeCoordinatesValue.GLOBE_EARTH.
      Parameters:
      globe -
    • processItemDocument

      public void processItemDocument(ItemDocument itemDocument)
      Description copied from interface: EntityDocumentProcessor
      Processes the given ItemDocument.
      Specified by:
      processItemDocument in interface EntityDocumentProcessor
      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.