You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@baremaps.apache.org by bc...@apache.org on 2023/05/21 18:38:31 UTC

[incubator-baremaps] 05/05: Fix issues after rebase

This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch gdal
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git

commit a895766433cc1521ca1eff7b3ec3240273740291
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Sun May 21 20:10:26 2023 +0200

    Fix issues after rebase
---
 .run/ContourTileStore.run.xml                      | 16 ------
 .../java/org/apache/baremaps/cli/map/Contour.java  | 14 ++----
 .../java/org/apache/baremaps/raster/AsterDem.java  | 58 ++++++++++++++++++++++
 .../apache/baremaps/raster/ContourTileStore.java   | 43 +++++++---------
 .../vectortile/{Tile.java => VectorTile.java}      |  6 +--
 .../baremaps/vectortile/VectorTileDecoder.java     | 21 ++++----
 .../baremaps/vectortile/VectorTileEncoder.java     | 35 ++++++-------
 .../baremaps/vectortile/VectorTileUtils.java       |  6 ++-
 .../apache/baremaps/vectortile/VectorTileTest.java |  5 +-
 .../baremaps/vectortile/VectorTileViewer.java      |  7 +--
 10 files changed, 120 insertions(+), 91 deletions(-)

diff --git a/.run/ContourTileStore.run.xml b/.run/ContourTileStore.run.xml
deleted file mode 100644
index 307d971d..00000000
--- a/.run/ContourTileStore.run.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="ContourTileStore" type="Application" factoryName="Application" nameIsGenerated="true">
-    <option name="MAIN_CLASS_NAME" value="org.apache.baremaps.raster.ContourTileStore" />
-    <module name="baremaps-core" />
-    <option name="VM_PARAMETERS" value="-Djava.library.path=$PROJECT_DIR$/../../osgeo/gdal/build/swig/java" />
-    <extension name="coverage">
-      <pattern>
-        <option name="PATTERN" value="org.apache.baremaps.raster.*" />
-        <option name="ENABLED" value="true" />
-      </pattern>
-    </extension>
-    <method v="2">
-      <option name="Make" enabled="true" />
-    </method>
-  </configuration>
-</component>
\ No newline at end of file
diff --git a/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/Contour.java b/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/Contour.java
index b301876b..32b4482b 100644
--- a/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/Contour.java
+++ b/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/Contour.java
@@ -13,32 +13,24 @@
 package org.apache.baremaps.cli.map;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.github.benmanes.caffeine.cache.CaffeineSpec;
 import io.servicetalk.http.netty.HttpServers;
 import io.servicetalk.http.router.jersey.HttpJerseyRouterBuilder;
-import org.apache.baremaps.cli.Options;
-import org.apache.baremaps.database.PostgresUtils;
-import org.apache.baremaps.database.tile.PostgresTileStore;
-import org.apache.baremaps.database.tile.TileCache;
-import org.apache.baremaps.database.tile.TileStore;
-import org.apache.baremaps.mvt.tileset.Tileset;
 import org.apache.baremaps.raster.ContourTileStore;
-import org.apache.baremaps.server.ConfigReader;
 import org.apache.baremaps.server.CorsFilter;
 import org.apache.baremaps.server.ServerResources;
+import org.apache.baremaps.tilestore.TileStore;
+import org.apache.baremaps.utils.ObjectMapperUtils;
 import org.glassfish.hk2.utilities.binding.AbstractBinder;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import picocli.CommandLine.Command;
-import picocli.CommandLine.Mixin;
 import picocli.CommandLine.Option;
 
 import java.nio.file.Path;
 import java.util.concurrent.Callable;
 
 import static io.servicetalk.data.jackson.jersey.ServiceTalkJacksonSerializerFeature.contextResolverFor;
-import static org.apache.baremaps.server.DefaultObjectMapper.defaultObjectMapper;
 
 @Command(name = "contour", description = "Start a tile server with caching capabilities.")
 public class Contour implements Callable<Integer> {
@@ -64,7 +56,7 @@ public class Contour implements Callable<Integer> {
 
   @Override
   public Integer call() throws Exception {
-    var objectMapper = defaultObjectMapper();
+    var objectMapper = ObjectMapperUtils.objectMapper();
     var tileStore = new ContourTileStore();
 
     // Configure the application
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/raster/AsterDem.java b/baremaps-core/src/main/java/org/apache/baremaps/raster/AsterDem.java
new file mode 100644
index 00000000..47f9a363
--- /dev/null
+++ b/baremaps-core/src/main/java/org/apache/baremaps/raster/AsterDem.java
@@ -0,0 +1,58 @@
+package org.apache.baremaps.raster;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class AsterDem {
+
+    public static void main(String[] args) throws IOException {
+
+        var target = Paths.get("/Volumes/Data/data/ASTGTMV003");
+        if (Files.notExists(target)) {
+            Files.createDirectories(target);
+        }
+        var baseUrl = "https://e4ftl01.cr.usgs.gov/ASTT/ASTGTM.003/2000.03.01/";
+        var token = "...";
+
+        var directoryUrl = new URL(baseUrl);
+        var directoryConnection = (HttpURLConnection) directoryUrl.openConnection();
+
+        var files = new ArrayList<String>();
+        try(var stream = new BufferedInputStream(directoryConnection.getInputStream())) {
+            var bytes = stream.readAllBytes();
+            var html = new String(bytes);
+            Pattern p = Pattern.compile("href=\"(ASTGTMV003_.*?)\"");
+            Matcher m = p.matcher(html);
+            while (m.find()) {
+                files.add(m.group(1));
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        files.parallelStream().forEach(file -> {
+            try {
+                if (Files.exists(target.resolve(file))) {
+                    return;
+                }
+                System.out.println("Downloading " + file);
+                var fileUrl = new URL(baseUrl + file);
+                var fileConnection = (HttpURLConnection) fileUrl.openConnection();
+                fileConnection.setRequestProperty("Authorization", "Bearer " + token);
+                try(var stream = new BufferedInputStream(fileConnection.getInputStream())) {
+                    Files.copy(stream, target.resolve(file), StandardCopyOption.REPLACE_EXISTING);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        });
+    }
+}
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/raster/ContourTileStore.java b/baremaps-core/src/main/java/org/apache/baremaps/raster/ContourTileStore.java
index bd206eee..2f2f9455 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/raster/ContourTileStore.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/raster/ContourTileStore.java
@@ -12,35 +12,30 @@
 
 package org.apache.baremaps.raster;
 
-import java.nio.ByteBuffer;
-import java.nio.file.Paths;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-import java.util.stream.IntStream;
-import java.util.stream.LongStream;
-
-import org.apache.baremaps.database.tile.Tile;
-import org.apache.baremaps.database.tile.TileStore;
-import org.apache.baremaps.database.tile.TileStoreException;
-import org.apache.baremaps.openstreetmap.utils.GeometryUtils;
-import org.apache.baremaps.openstreetmap.utils.ProjectionTransformer;
+import org.apache.baremaps.tilestore.TileCoord;
+import org.apache.baremaps.tilestore.TileStore;
+import org.apache.baremaps.tilestore.TileStoreException;
+import org.apache.baremaps.utils.GeometryUtils;
 import org.apache.baremaps.vectortile.Feature;
 import org.apache.baremaps.vectortile.Layer;
-import org.apache.baremaps.vectortile.VectorTileEncoder;
+import org.apache.baremaps.vectortile.VectorTile;
 import org.apache.baremaps.vectortile.VectorTileUtils;
 import org.gdal.gdal.Dataset;
 import org.gdal.gdal.WarpOptions;
 import org.gdal.gdal.gdal;
 import org.gdal.gdalconst.gdalconstConstants;
-import org.gdal.ogr.FieldDefn;
 import org.gdal.ogr.ogr;
 import org.gdal.osr.SpatialReference;
 import org.locationtech.jts.geom.Envelope;
-import org.locationtech.jts.geom.GeometryFactory;
-import org.locationtech.jts.geom.util.GeometryTransformer;
 import org.locationtech.proj4j.ProjCoordinate;
 
+import java.nio.ByteBuffer;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+import java.util.stream.LongStream;
+
 public class ContourTileStore implements TileStore, AutoCloseable {
 
   static {
@@ -51,12 +46,12 @@ public class ContourTileStore implements TileStore, AutoCloseable {
   private final Dataset sourceDataset;
 
   public ContourTileStore() {
-    var dem = Paths.get("examples/contour/dem.xml").toAbsolutePath().toString();
+    var dem = Paths.get("dem.xml").toAbsolutePath().toString();
     sourceDataset = gdal.Open(dem, gdalconstConstants.GA_ReadOnly);
   }
 
   @Override
-  public ByteBuffer read(Tile tile) throws TileStoreException {
+  public ByteBuffer read(TileCoord tile) throws TileStoreException {
     var sourceBand = sourceDataset.GetRasterBand(1);
     var envelope = tile.envelope();
 
@@ -91,8 +86,7 @@ public class ContourTileStore implements TileStore, AutoCloseable {
             .map(geometry -> new Feature(null, Map.of(), geometry))
             .toList();
 
-    var vectorTile = VectorTileUtils.asVectorTile(new org.apache.baremaps.vectortile.Tile(List.of(new Layer("contours", 4096, features))));
-
+    var vectorTile = VectorTileUtils.asVectorTile(new VectorTile(List.of(new Layer("contours", 4096, features))));
 
     rasterBand.delete();
     rasterDataset.delete();
@@ -102,12 +96,12 @@ public class ContourTileStore implements TileStore, AutoCloseable {
   }
 
   @Override
-  public void write(Tile tile, ByteBuffer blob) throws TileStoreException {
+  public void write(TileCoord tile, ByteBuffer blob) throws TileStoreException {
     throw new UnsupportedOperationException();
   }
 
   @Override
-  public void delete(Tile tile) throws TileStoreException {
+  public void delete(TileCoord tile) throws TileStoreException {
     throw new UnsupportedOperationException();
   }
 
@@ -118,8 +112,7 @@ public class ContourTileStore implements TileStore, AutoCloseable {
 
   public static void main(String[] args) throws Exception {
     var store = new ContourTileStore();
-    store.read(new Tile(8492, 5792, 14).parent());
-
+    store.read(new TileCoord(8492, 5792, 14).parent());
   }
 
 }
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/vectortile/Tile.java b/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTile.java
similarity index 92%
rename from baremaps-core/src/main/java/org/apache/baremaps/vectortile/Tile.java
rename to baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTile.java
index 7fb6b7c4..24c63992 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/vectortile/Tile.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTile.java
@@ -18,14 +18,14 @@ import java.util.List;
 /**
  * A vector tile layer.
  */
-public class Tile {
+public class VectorTile {
 
   private List<Layer> layers;
 
   /**
    * Creates a new tile.
    */
-  public Tile(List<Layer> layers) {
+  public VectorTile(List<Layer> layers) {
     this.layers = layers;
   }
 
@@ -53,7 +53,7 @@ public class Tile {
       return true;
     if (o == null || getClass() != o.getClass())
       return false;
-    Tile tile = (Tile) o;
+    VectorTile tile = (VectorTile) o;
     return Objects.equal(layers, tile.layers);
   }
 
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileDecoder.java b/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileDecoder.java
index 5e5a9cad..5b90747e 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileDecoder.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileDecoder.java
@@ -19,7 +19,8 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.*;
 import java.util.stream.Collectors;
-import org.apache.baremaps.mvt.binary.VectorTile;
+
+import org.apache.baremaps.mvt.binary.VectorTile.Tile;
 import org.apache.baremaps.mvt.binary.VectorTile.Tile.GeomType;
 import org.apache.baremaps.mvt.binary.VectorTile.Tile.Value;
 import org.locationtech.jts.geom.*;
@@ -52,9 +53,9 @@ public class VectorTileDecoder {
    * @return The decoded vector tile
    * @throws IOException If an error occurs while decoding the vector tile
    */
-  public Tile decodeTile(ByteBuffer buffer) throws IOException {
+  public VectorTile decodeTile(ByteBuffer buffer) throws IOException {
     try {
-      VectorTile.Tile tile = VectorTile.Tile.parseFrom(buffer);
+      org.apache.baremaps.mvt.binary.VectorTile.Tile tile = Tile.parseFrom(buffer);
       return decodeTile(tile);
     } catch (InvalidProtocolBufferException e) {
       throw new IOException(e);
@@ -67,11 +68,11 @@ public class VectorTileDecoder {
    * @param tile The vector tile to decode
    * @return The decoded vector tile
    */
-  public Tile decodeTile(VectorTile.Tile tile) {
+  public VectorTile decodeTile(Tile tile) {
     List<Layer> layers = tile.getLayersList().stream()
         .map(this::decodeLayer)
         .collect(Collectors.toList());
-    return new Tile(layers);
+    return new VectorTile(layers);
   }
 
   /**
@@ -83,7 +84,7 @@ public class VectorTileDecoder {
    */
   public Layer decodeLayer(ByteBuffer buffer) throws IOException {
     try {
-      VectorTile.Tile.Layer layer = VectorTile.Tile.Layer.parseFrom(buffer);
+      Tile.Layer layer = Tile.Layer.parseFrom(buffer);
       return decodeLayer(layer);
     } catch (InvalidProtocolBufferException e) {
       throw new IOException(e);
@@ -96,7 +97,7 @@ public class VectorTileDecoder {
    * @param layer The vector tile layer
    * @return The decoded layer
    */
-  public Layer decodeLayer(VectorTile.Tile.Layer layer) {
+  public Layer decodeLayer(Tile.Layer layer) {
     String name = layer.getName();
     int extent = layer.getExtent();
 
@@ -147,7 +148,7 @@ public class VectorTileDecoder {
    * @param feature The vector tile feature to decode
    * @return The decoded feature
    */
-  protected Feature decodeFeature(VectorTile.Tile.Feature feature) {
+  protected Feature decodeFeature(Tile.Feature feature) {
 
     cx = 0;
     cy = 0;
@@ -164,7 +165,7 @@ public class VectorTileDecoder {
    * @param feature The feature to decode
    * @return The tags of the feature
    */
-  protected Map<String, Object> decodeTags(VectorTile.Tile.Feature feature) {
+  protected Map<String, Object> decodeTags(Tile.Feature feature) {
     Map<String, Object> tags = new HashMap<>();
     List<Integer> encoding = feature.getTagsList();
     for (int i = 0; i < encoding.size(); i += 2) {
@@ -181,7 +182,7 @@ public class VectorTileDecoder {
    * @param feature The vector tile feature
    * @return The decoded geometry
    */
-  protected Geometry decodeGeometry(VectorTile.Tile.Feature feature) {
+  protected Geometry decodeGeometry(Tile.Feature feature) {
     GeomType type = feature.getType();
     List<Integer> encoding = feature.getGeometryList();
     switch (type) {
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileEncoder.java b/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileEncoder.java
index 4e4b427d..715bcf25 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileEncoder.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileEncoder.java
@@ -20,7 +20,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.function.Consumer;
-import org.apache.baremaps.mvt.binary.VectorTile;
+
+import org.apache.baremaps.mvt.binary.VectorTile.Tile;
 import org.locationtech.jts.geom.*;
 
 /**
@@ -51,8 +52,8 @@ public class VectorTileEncoder {
    * @param tile The tile to encode
    * @return The vector tile
    */
-  public VectorTile.Tile encodeTile(Tile tile) {
-    VectorTile.Tile.Builder builder = VectorTile.Tile.newBuilder();
+  public Tile encodeTile(VectorTile tile) {
+    Tile.Builder builder = Tile.newBuilder();
     tile.getLayers().forEach(layer -> builder.addLayers(encodeLayer(layer)));
     return builder.build();
   }
@@ -63,11 +64,11 @@ public class VectorTileEncoder {
    * @param layer The layer to encode
    * @return The vector tile layer
    */
-  public VectorTile.Tile.Layer encodeLayer(Layer layer) {
+  public Tile.Layer encodeLayer(Layer layer) {
     keys = new ArrayList<>();
     values = new ArrayList<>();
 
-    VectorTile.Tile.Layer.Builder builder = VectorTile.Tile.Layer.newBuilder();
+    Tile.Layer.Builder builder = Tile.Layer.newBuilder();
     builder.setName(layer.getName());
     builder.setVersion(2);
     builder.setExtent(layer.getExtent());
@@ -89,8 +90,8 @@ public class VectorTileEncoder {
    * @param object The object to encode
    * @return The vector tile value
    */
-  protected VectorTile.Tile.Value encodeValue(Object object) {
-    VectorTile.Tile.Value.Builder builder = VectorTile.Tile.Value.newBuilder();
+  protected Tile.Value encodeValue(Object object) {
+    Tile.Value.Builder builder = Tile.Value.newBuilder();
 
     // Encode the value based on its type
     if (object instanceof String value) {
@@ -115,11 +116,11 @@ public class VectorTileEncoder {
    *
    * @param feature The feature to encode.
    */
-  protected void encodeFeature(Feature feature, Consumer<VectorTile.Tile.Feature> consumer) {
+  protected void encodeFeature(Feature feature, Consumer<Tile.Feature> consumer) {
     cx = 0;
     cy = 0;
 
-    VectorTile.Tile.Feature.Builder builder = VectorTile.Tile.Feature.newBuilder();
+    Tile.Feature.Builder builder = Tile.Feature.newBuilder();
     if (feature.getId() != null) {
       builder.setId(feature.getId());
     }
@@ -130,21 +131,21 @@ public class VectorTileEncoder {
     consumer.accept(builder.build());
   }
 
-  protected VectorTile.Tile.GeomType encodeGeometryType(Geometry geometry) {
+  protected Tile.GeomType encodeGeometryType(Geometry geometry) {
     if (geometry instanceof Point) {
-      return VectorTile.Tile.GeomType.POINT;
+      return Tile.GeomType.POINT;
     } else if (geometry instanceof MultiPoint) {
-      return VectorTile.Tile.GeomType.POINT;
+      return Tile.GeomType.POINT;
     } else if (geometry instanceof LineString) {
-      return VectorTile.Tile.GeomType.LINESTRING;
+      return Tile.GeomType.LINESTRING;
     } else if (geometry instanceof MultiLineString) {
-      return VectorTile.Tile.GeomType.LINESTRING;
+      return Tile.GeomType.LINESTRING;
     } else if (geometry instanceof Polygon) {
-      return VectorTile.Tile.GeomType.POLYGON;
+      return Tile.GeomType.POLYGON;
     } else if (geometry instanceof MultiPolygon) {
-      return VectorTile.Tile.GeomType.POLYGON;
+      return Tile.GeomType.POLYGON;
     } else {
-      return VectorTile.Tile.GeomType.UNKNOWN;
+      return Tile.GeomType.UNKNOWN;
     }
   }
 
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileUtils.java b/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileUtils.java
index 1862c157..3bab5c83 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileUtils.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileUtils.java
@@ -87,7 +87,11 @@ public class VectorTileUtils {
    * @param vectorTile The tile to transform
    * @return The transformed tile
    */
-  public static ByteBuffer asVectorTile(Tile vectorTile) {
+  public static ByteBuffer asVectorTile(VectorTile vectorTile) {
+    ByteBuffer original = new VectorTileEncoder()
+            .encodeTile(vectorTile)
+            .toByteString()
+            .asReadOnlyByteBuffer();
     ByteBuffer clone = ByteBuffer.allocate(original.capacity());
     original.rewind();//copy from the beginning
     clone.put(original);
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/vectortile/VectorTileTest.java b/baremaps-core/src/test/java/org/apache/baremaps/vectortile/VectorTileTest.java
index db66f294..d8c91e7b 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/vectortile/VectorTileTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/vectortile/VectorTileTest.java
@@ -15,7 +15,6 @@ package org.apache.baremaps.vectortile;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 
-import java.awt.*;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.file.Files;
@@ -23,7 +22,7 @@ import java.nio.file.Path;
 import java.util.List;
 import java.util.Map;
 import java.util.zip.GZIPInputStream;
-import javax.swing.*;
+
 import org.junit.jupiter.api.Test;
 import org.locationtech.jts.geom.Coordinate;
 import org.locationtech.jts.geom.GeometryFactory;
@@ -34,7 +33,7 @@ public class VectorTileTest {
 
   @Test
   public void endToEnd() {
-    var tile = new Tile(List.of(
+    var tile = new VectorTile(List.of(
         new Layer("layer", 256, List.of(
             new Feature(1l, Map.of("a", 1.0, "b", "2"),
                 GEOMETRY_FACTORY.createPoint(new Coordinate(1, 2))),
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/vectortile/VectorTileViewer.java b/baremaps-core/src/test/java/org/apache/baremaps/vectortile/VectorTileViewer.java
index 349c666c..844367ad 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/vectortile/VectorTileViewer.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/vectortile/VectorTileViewer.java
@@ -16,9 +16,6 @@ import java.awt.*;
 import java.awt.Dimension;
 import java.net.URL;
 import java.nio.ByteBuffer;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.zip.GZIPInputStream;
 import javax.swing.*;
 import org.locationtech.jts.geom.*;
 import org.locationtech.jts.geom.Point;
@@ -51,11 +48,11 @@ public class VectorTileViewer {
 
   static class TilePanel extends JPanel {
 
-    private final Tile tile;
+    private final VectorTile tile;
 
     private final int extent;
 
-    public TilePanel(Tile tile, int extent) {
+    public TilePanel(VectorTile tile, int extent) {
       this.tile = tile;
       this.extent = extent;
     }