Class OsmXmlSegmenter

java.lang.Object
org.ka2ddo.yaac.osm.OsmSegmenter
org.ka2ddo.yaac.osm.OsmXmlSegmenter

public class OsmXmlSegmenter extends OsmSegmenter
This class parses an OpenStreetMaps compressed XML file into a series of one-degree "square" tiles of map data, stored in a compact binary format suitable for efficient and fast rendering.

Special Java command-line parameters can be defined with the -D option to alter the operation of this class. These are:

  • alt.tile.dir=/directory/path - specify where to put the temporary files that are used as a brute-force indexed OSM Node position table. Default is the configured tile directory specified in the YAAC Preferences, but a partition on another disk spindle could be used to reduce disk seeking latency.
  • skip.osm.xml.parse - if defined, skip reading the OSM input file and just re-sort and merge any new *.ways.tmp and *.nodes.tmp files into the operational *.ways and *.nodes files. Useful if the import crashes prior to completing the sort and merge phase.
  • dont.purge.temp - if defined, don't delete the temporary files when the processing is complete.
Author:
Andrew Pavlin, KA2DDO
  • Constructor Details

    • OsmXmlSegmenter

      public OsmXmlSegmenter(String rootTilePath) throws IOException
      Constructor for bzipped XML OSM file segmenter,
      Parameters:
      rootTilePath - String pathname of the configured tile directory
      Throws:
      IOException - if tile directory cannot be created
  • Method Details

    • getMinHeapRequired

      protected long getMinHeapRequired()
      Check if there is enough heap available for the importer to operate without guaranteed OutOfMemoryErrors due to the minimum size of data structures that will be simultaneously allocated during import.
      Specified by:
      getMinHeapRequired in class OsmSegmenter
      Returns:
      localized error message String, or null if no problem detected
    • parse

      public void parse(FileInputStream fileInputStream, NonshareableCountingBufferedDataInputStream inputStream, File inputFile, boolean useFixMe, StatusListener listener) throws IOException, ParserConfigurationException, SAXException
      Parse a compressed XML file into YAAC's version of OpenStreetMap tiles.
      Specified by:
      parse in class OsmSegmenter
      Parameters:
      fileInputStream - FileInputStream underlying the input stream being used
      inputStream - NonshareableCountingBufferedDataInputStream reading a BZIP2-compressed XML file
      inputFile - File of the OpenStreetMap snapshot file being read
      useFixMe - boolean true if FIXME-tagged elements of the OSM data are to be included
      listener - StatusListener to receive progress report of the import
      Throws:
      IOException - if the input file cannot be read or any of the output files cannot be written
      ParserConfigurationException - if the Java runtime's XML parser cannot handle its configuration parameters
      SAXException - if the XML parser cannot decode the file