diff --git a/apps/src/main/java/org/hortonmachine/nww/layers/defaults/raster/OepnvkarteLayer.java b/apps/src/main/java/org/hortonmachine/nww/layers/defaults/raster/OepnvkarteLayer.java new file mode 100644 index 000000000..ea0645ff4 --- /dev/null +++ b/apps/src/main/java/org/hortonmachine/nww/layers/defaults/raster/OepnvkarteLayer.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2012 United States Government as represented by the Administrator of the + * National Aeronautics and Space Administration. + * All Rights Reserved. + */ +package org.hortonmachine.nww.layers.defaults.raster; + +import java.net.MalformedURLException; +import java.net.URL; + +import gov.nasa.worldwind.avlist.AVKey; +import gov.nasa.worldwind.avlist.AVList; +import gov.nasa.worldwind.avlist.AVListImpl; +import gov.nasa.worldwind.geom.Angle; +import gov.nasa.worldwind.geom.LatLon; +import gov.nasa.worldwind.layers.mercator.MercatorSector; +import gov.nasa.worldwind.util.LevelSet; +import gov.nasa.worldwind.util.Tile; +import gov.nasa.worldwind.util.TileUrlBuilder; + +/** + * @version $Id: OSMMapnikLayer.java 1171 2013-02-11 21:45:02Z dcollins $ + */ +public class OepnvkarteLayer extends BasicMercatorTiledImageLayer { + public OepnvkarteLayer() { + super(makeLevels()); + } + + private static LevelSet makeLevels() { + AVList params = new AVListImpl(); + + params.setValue(AVKey.TILE_WIDTH, 256); + params.setValue(AVKey.TILE_HEIGHT, 256); + params.setValue(AVKey.DATA_CACHE_NAME, "Earth/OSM-Mercator/Oepnvkarte"); + params.setValue(AVKey.SERVICE, "http://tile.memomaps.de/tilegen//"); + params.setValue(AVKey.DATASET_NAME, "h"); + params.setValue(AVKey.FORMAT_SUFFIX, ".png"); + params.setValue(AVKey.NUM_LEVELS, 22); + params.setValue(AVKey.NUM_EMPTY_LEVELS, 0); + params.setValue(AVKey.LEVEL_ZERO_TILE_DELTA, new LatLon(Angle.fromDegrees(22.5d), Angle.fromDegrees(45d))); + params.setValue(AVKey.SECTOR, new MercatorSector(-1.0, 1.0, Angle.NEG180, Angle.POS180)); + params.setValue(AVKey.TILE_URL_BUILDER, new URLBuilder()); + + return new LevelSet(params); + } + + private static class URLBuilder implements TileUrlBuilder { + public URL getURL( Tile tile, String imageFormat ) throws MalformedURLException { + int zoom = tile.getLevelNumber() + 3; + int x = tile.getColumn(); + int y = (1 << (tile.getLevelNumber()) + 3) - 1 - tile.getRow(); + + return new URL(tile.getLevel().getService() + zoom + "/" + x + "/" + y + ".png"); + } + } + + @Override + public String toString() { + return "Öpnvkarte Transport Map"; + } +} diff --git a/apps/src/main/java/org/hortonmachine/nww/layers/defaults/raster/OpenTopoLayer.java b/apps/src/main/java/org/hortonmachine/nww/layers/defaults/raster/OpenTopoLayer.java new file mode 100644 index 000000000..252ac9799 --- /dev/null +++ b/apps/src/main/java/org/hortonmachine/nww/layers/defaults/raster/OpenTopoLayer.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2012 United States Government as represented by the Administrator of the + * National Aeronautics and Space Administration. + * All Rights Reserved. + */ +package org.hortonmachine.nww.layers.defaults.raster; + +import java.net.MalformedURLException; +import java.net.URL; + +import gov.nasa.worldwind.avlist.AVKey; +import gov.nasa.worldwind.avlist.AVList; +import gov.nasa.worldwind.avlist.AVListImpl; +import gov.nasa.worldwind.geom.Angle; +import gov.nasa.worldwind.geom.LatLon; +import gov.nasa.worldwind.layers.mercator.MercatorSector; +import gov.nasa.worldwind.util.LevelSet; +import gov.nasa.worldwind.util.Tile; +import gov.nasa.worldwind.util.TileUrlBuilder; + +/** + * @version $Id: OSMMapnikLayer.java 1171 2013-02-11 21:45:02Z dcollins $ + */ +public class OpenTopoLayer extends BasicMercatorTiledImageLayer { + public OpenTopoLayer() { + super(makeLevels()); + } + + private static LevelSet makeLevels() { + AVList params = new AVListImpl(); + + params.setValue(AVKey.TILE_WIDTH, 256); + params.setValue(AVKey.TILE_HEIGHT, 256); + params.setValue(AVKey.DATA_CACHE_NAME, "Earth/OSM-Mercator/OpenStreetMap Mapnik"); + params.setValue(AVKey.SERVICE, "https://a.tile.opentopomap.org/"); + params.setValue(AVKey.DATASET_NAME, "h"); + params.setValue(AVKey.FORMAT_SUFFIX, ".png"); + params.setValue(AVKey.NUM_LEVELS, 22); + params.setValue(AVKey.NUM_EMPTY_LEVELS, 0); + params.setValue(AVKey.LEVEL_ZERO_TILE_DELTA, new LatLon(Angle.fromDegrees(22.5d), Angle.fromDegrees(45d))); + params.setValue(AVKey.SECTOR, new MercatorSector(-1.0, 1.0, Angle.NEG180, Angle.POS180)); + params.setValue(AVKey.TILE_URL_BUILDER, new URLBuilder()); + + return new LevelSet(params); + } + + private static class URLBuilder implements TileUrlBuilder { + public URL getURL( Tile tile, String imageFormat ) throws MalformedURLException { + int zoom = tile.getLevelNumber() + 3; + int x = tile.getColumn(); + int y = (1 << (tile.getLevelNumber()) + 3) - 1 - tile.getRow(); + + return new URL(tile.getLevel().getService() + zoom + "/" + x + "/" + y + ".png"); + } + } + + @Override + public String toString() { + return "OpenTopoMap"; + } +}