Package org.ka2ddo.yaac.osm
Class OsmPbfSegmenter
java.lang.Object
org.ka2ddo.yaac.osm.OsmSegmenter
org.ka2ddo.yaac.osm.OsmPbfSegmenter
- All Implemented Interfaces:
AbortListener
,OsmSegmenter.ReportUpdates
public class OsmPbfSegmenter
extends OsmSegmenter
implements AbortListener, OsmSegmenter.ReportUpdates
This class parses an OpenStreetMaps PBF (protocol buffers) file into a series of one-degree
"square" tiles of map data, stored in a compact binary format suitable for efficient
and fast rendering by YAAC. This format is documented at
https://wiki.openstreetmap.org/wiki/PBF_Format.
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ka2ddo.yaac.osm.OsmSegmenter
OsmSegmenter.AcceptTileSubdirsOrPlanetWays, OsmSegmenter.BoundsToNameTag, OsmSegmenter.ReportUpdates, OsmSegmenter.WayFileSorter
-
Field Summary
Fields inherited from class org.ka2ddo.yaac.osm.OsmSegmenter
ESTIMATED_EXTRA_TILE_SPACE, ESTIMATED_TEMP_TILE_SPACE, FILETYPE_SUFFIXES, FILETYPE_SWAY, FILETYPE_WAY, MAX_LATITUDE, MAX_LONGITUDE, MIN_LATITUDE, MIN_LONGITUDE, numDupWaysDeleted, numNodeFiles, numSortFailures, numWayFiles, planetDos, RELATIONS_STATS_MAP_ENTRY_COMPARATOR, tileRootDirectory, tileTmpDirectory
-
Constructor Summary
ConstructorDescriptionOsmPbfSegmenter
(String rootTilePath) Constructor for protocol buffers OSM file segmenter, -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called from the user interface when the user requests a cancel.protected long
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.void
parse
(FileInputStream fileInputStream, NonshareableCountingBufferedDataInputStream inputStream, File inputFile, boolean useFixMe, StatusListener listener) Parse an OSM PBF file into YAAC's version of OpenStreetMap tiles.void
updateMessage
(String countString) Report a status update string to the progress indicator (if one was provided).Methods inherited from class org.ka2ddo.yaac.osm.OsmSegmenter
checkDiskSpace, computeActiveQueueCount, computeQueuesBacklog, findBiggestQueue, produceSortStatusMessage, refreshMapWindows
-
Constructor Details
-
OsmPbfSegmenter
Constructor for protocol buffers 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 classOsmSegmenter
- Returns:
- localized error message String, or null if no problem detected
-
cancelRequested
public void cancelRequested()Called from the user interface when the user requests a cancel. Implementations of this method should not block, but should quickly inform the associated long-running background thread to abort its operation.- Specified by:
cancelRequested
in interfaceAbortListener
-
updateMessage
Report a status update string to the progress indicator (if one was provided).- Specified by:
updateMessage
in interfaceOsmSegmenter.ReportUpdates
- Parameters:
countString
- String to report- Throws:
UserAbort
- if user clicked the abort button
-