Class OsmDownloader

java.lang.Object
org.ka2ddo.yaac.osm.OsmDownloader

public class OsmDownloader extends Object
Code for downloading OpenStreetMap imported "tile" files from author's website.
Author:
Andrew Pavlin, KA2DDO
  • 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 not
      showProgressDialog - 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 installation
      tileDownloadParams - 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 hierarchy
      bLat - 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 statistics
      refreshExisting - if boolean true, skip downloading tiles that did not exist previously
      recordFilter - 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