Package org.ka2ddo.yaac.osm
Class OsmDownloader
java.lang.Object
org.ka2ddo.yaac.osm.OsmDownloader
Code for downloading OpenStreetMap imported "tile" files from author's website.
- Author:
- Andrew Pavlin, KA2DDO
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Structure of statistics reported by the downloadTileFile() method. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
downloadTileFile
(String hostIpAddress, String webTileDir, File tileDir, int bLat, int bLon, String suffix, StatusListener pd, OsmDownloader.TileDownloadStatistics statistics, boolean refreshExisting, VisibleCtls recordFilter) Download one tile file (ways or nodes) from a specific tile directory.static void
loadPrecompiledTiles
(ChangeSet serverChangeSetCopy, boolean showProgressDialog, GuiIfc.TileDownloadParams tileDownloadParams) Download already-imported tiles from the program author's website and store them in the local tile directory.
-
Method Details
-
loadPrecompiledTiles
public static void loadPrecompiledTiles(ChangeSet serverChangeSetCopy, boolean showProgressDialog, GuiIfc.TileDownloadParams tileDownloadParams) Download already-imported tiles from the program author's website and store them in the local tile directory. Note this does not check if the tiles are already up-to-date; the UI dialog that invokes this is supposed to give the user the opportunity to check this before actually starting a download. This also checks the ShowUnlabeledWays property of the OSMLayer class to see if extra tile files of untyped/unlabeled map data should be downloaded.- Parameters:
serverChangeSetCopy
- the ChangeSet already downloaded from the tile webserver to let the user decide whether to update or notshowProgressDialog
- boolean true if a progress dialog should be launched to show the progress of this; should normally be true, but the configuration wizard sets it to false to not confuse the neophyte user while they are still configuring their installationtileDownloadParams
- GuiIfc.TileDownloadParams structure identifying which tiles and records therein should be downloaded
-
downloadTileFile
public static boolean downloadTileFile(String hostIpAddress, String webTileDir, File tileDir, int bLat, int bLon, String suffix, StatusListener pd, OsmDownloader.TileDownloadStatistics statistics, boolean refreshExisting, VisibleCtls recordFilter) throws IOException Download one tile file (ways or nodes) from a specific tile directory. The parent directory for the tile directory can be overridden from the default by defining the Java property dated.tile.dir to be the directory name. To preserve the privacy of users, this will use HTTPS to hide the transfer URL from traffic sniffers if HTTP is not forced.- Parameters:
hostIpAddress
- String of numeric IP address of webserver (to avoid repeated lookups)webTileDir
- String of subdirectory on webserver where tile files are located, or null to use default of property value of dated.tile.dir property, or just "tiledir"tileDir
- root directory of the tile hierarchybLat
- latitude of tile (degrees only)bLon
- longitude of tile (degrees only)suffix
- file suffix ".ways" or ".nodes", or entire file name "planet.ways"pd
- StatusListener to receive progress reports (or null if progress is not to be reported)statistics
- TileDownloadStatistics object to accumulate statisticsrefreshExisting
- if boolean true, skip downloading tiles that did not exist previouslyrecordFilter
- VisibleEnum struct specifying which WayTypes and AmenityTypes should be accepted, or null to accept everything @return boolean true if a tile was downloaded, false if new tile does not exist- Returns:
- boolean true if tile file was downloaded, false if not
- Throws:
IOException
- if data cannot be transferred for some reason
-