mapjfx 2.9.0 and 1.28.0 with offline cache improvements

I just released mapjfx versions 1.28.0 and 2.9.0, they will be available in maven central:

  <dependency>
    <groupId>com.sothawo</groupId>
    <artifactId>mapjfx</artifactId>
    <version>1.28.0</version>
  </dependency>
  <dependency>
    <groupId>com.sothawo</groupId>
    <artifactId>mapjfx</artifactId>
    <version>2.9.0</version>
  </dependency>

1.28.0 is bilt using Java 8 and 2.9.0 uses Java 12.

These releases add the possibility to pass a list of URLs (map tiles) to the OfflineCache to have the cache populated in the background with the data from these URLs (https://github.com/sothawo/mapjfx/issues/64)

Example:

private void initOfflineCache() {
    final OfflineCache offlineCache = OfflineCache.INSTANCE;
    offlineCache.setCacheDirectory(FileSystems.getDefault().getPath("tmpdata/cache"));
    offlineCache.setActive(true);
    offlineCache.setNoCacheFilters(Collections.singletonList(".*\\.sothawo\\.com/.*"));

    LinkedList<String> urls = new LinkedList<>();
    urls.add("https://c.tile.openstreetmap.org/14/8572/5626.png");
    urls.add("https://b.tile.openstreetmap.org/14/8571/5626.png");
    urls.add("https://a.tile.openstreetmap.org/14/8572/5625.png");
    urls.add("https://c.tile.openstreetmap.org/14/8571/5625.png");
    urls.add("https://b.tile.openstreetmap.org/14/8570/5625.png");
    urls.add("https://a.tile.openstreetmap.org/14/8572/5625.png");
    urls.add("https://a.tile.openstreetmap.org/14/8570/5626.png");
    urls.add("https://a.tile.openstreetmap.org/14/8571/5627.png");
    urls.add("https://a.tile.openstreetmap.org/14/8573/5626.png");
    urls.add("https://a.tile.openstreetmap.org/14/8574/5627.png");
    urls.add("https://b.tile.openstreetmap.org/14/8571/5626.png");
    urls.add("https://b.tile.openstreetmap.org/14/8573/5625.png");
    urls.add("https://b.tile.openstreetmap.org/14/8572/5627.png");
    urls.add("https://b.tile.openstreetmap.org/14/8574/5626.png");
    urls.add("https://c.tile.openstreetmap.org/14/8572/5626.png");
    urls.add("https://c.tile.openstreetmap.org/14/8570/5627.png");
    urls.add("https://c.tile.openstreetmap.org/14/8574/5625.png");
    urls.add("https://c.tile.openstreetmap.org/14/8573/5627.png");

    offlineCache.preloadURLs(urls);
}

 

Leave a Reply

Your email address will not be published.