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/09/25 21:10:01 UTC
[incubator-baremaps] 05/07: 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 5571fdeeeef774763660fe9c0bb908a818ef38c9
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 | 6 +-
baremaps-core/pom.xml | 44 +++++++-------
.../java/org/apache/baremaps/raster/AsterDem.java | 70 ++++++++++++++++++++++
.../apache/baremaps/raster/ContourTileStore.java | 13 ++--
.../java/org/apache/baremaps/raster/Image.java | 35 +++++++----
.../vectortile/{Tile.java => VectorTile.java} | 6 +-
.../baremaps/vectortile/VectorTileDecoder.java | 20 +++----
.../baremaps/vectortile/VectorTileEncoder.java | 34 +++++------
.../baremaps/vectortile/VectorTileFunctions.java | 8 +--
.../vectortile/VectorTileFunctionsTest.java | 3 +-
.../apache/baremaps/vectortile/VectorTileTest.java | 4 +-
.../baremaps/vectortile/VectorTileViewer.java | 4 +-
13 files changed, 164 insertions(+), 99 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 055456d5..de4b9e94 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,17 +13,17 @@
package org.apache.baremaps.cli.map;
import static io.servicetalk.data.jackson.jersey.ServiceTalkJacksonSerializerFeature.contextResolverFor;
-import static org.apache.baremaps.server.DefaultObjectMapper.defaultObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.servicetalk.http.netty.HttpServers;
import io.servicetalk.http.router.jersey.HttpJerseyRouterBuilder;
import java.nio.file.Path;
import java.util.concurrent.Callable;
-import org.apache.baremaps.database.tile.TileStore;
import org.apache.baremaps.raster.ContourTileStore;
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;
@@ -55,7 +55,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/pom.xml b/baremaps-core/pom.xml
index 7c364c2d..4beb482b 100644
--- a/baremaps-core/pom.xml
+++ b/baremaps-core/pom.xml
@@ -20,29 +20,7 @@
<artifactId>baremaps-core</artifactId>
- <repositories>
- <repository>
- <id>twelvemonkeys</id>
- <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
- </repository>
- </repositories>
-
<dependencies>
- <dependency>
- <groupId>com.twelvemonkeys.imageio</groupId>
- <artifactId>imageio-tiff</artifactId>
- <version>3.10.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>com.twelvemonkeys.imageio</groupId>
- <artifactId>imageio-metadata</artifactId>
- <version>3.9.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.sis.storage</groupId>
- <artifactId>sis-geotiff</artifactId>
- <version>1.3</version>
- </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
@@ -83,6 +61,16 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.twelvemonkeys.imageio</groupId>
+ <artifactId>imageio-metadata</artifactId>
+ <version>3.9.4</version>
+ </dependency>
+ <dependency>
+ <groupId>com.twelvemonkeys.imageio</groupId>
+ <artifactId>imageio-tiff</artifactId>
+ <version>3.10.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
@@ -127,6 +115,11 @@
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spatial-extras</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.sis.storage</groupId>
+ <artifactId>sis-geotiff</artifactId>
+ <version>1.3</version>
+ </dependency>
<dependency>
<groupId>org.gdal</groupId>
<artifactId>gdal</artifactId>
@@ -167,6 +160,13 @@
</dependency>
</dependencies>
+ <repositories>
+ <repository>
+ <id>twelvemonkeys</id>
+ <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
+ </repository>
+ </repositories>
+
<build>
<plugins>
<plugin>
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..8ce28143
--- /dev/null
+++ b/baremaps-core/src/main/java/org/apache/baremaps/raster/AsterDem.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+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 bce42cd5..5eeb5855 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
@@ -24,6 +24,7 @@ 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.VectorTile;
import org.apache.baremaps.vectortile.VectorTileFunctions;
import org.gdal.gdal.Dataset;
import org.gdal.gdal.WarpOptions;
@@ -32,7 +33,6 @@ import org.gdal.gdalconst.gdalconstConstants;
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.proj4j.ProjCoordinate;
public class ContourTileStore implements TileStore, AutoCloseable {
@@ -45,7 +45,7 @@ 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);
}
@@ -84,13 +84,13 @@ public class ContourTileStore implements TileStore, AutoCloseable {
.mapToObj(vectorLayer::GetFeature)
.map(feature -> feature.GetGeometryRef())
.map(geometry -> GeometryUtils.deserialize(geometry.ExportToWkb()))
- .map(geometry -> VectorTileFunctions.asVectorTileGeom(geometry, targetEnvelope, 4096, 0, true))
+ .map(geometry -> VectorTileFunctions.asVectorTileGeom(geometry, targetEnvelope, 4096, 0,
+ true))
.map(geometry -> new Feature(null, Map.of(), geometry))
.toList();
- var vectorTile = VectorTileFunctions.asVectorTile(
- new org.apache.baremaps.vectortile.Tile(List.of(new Layer("contours", 4096, features))));
-
+ var vectorTile = VectorTileFunctions
+ .asVectorTile(new VectorTile(List.of(new Layer("contours", 4096, features))));
rasterBand.delete();
rasterDataset.delete();
@@ -117,7 +117,6 @@ public class ContourTileStore implements TileStore, AutoCloseable {
public static void main(String[] args) throws Exception {
var store = new ContourTileStore();
store.read(new TileCoord(8492, 5792, 14).parent());
-
}
}
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/raster/Image.java b/baremaps-core/src/main/java/org/apache/baremaps/raster/Image.java
index 896304be..b26e3a53 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/raster/Image.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/raster/Image.java
@@ -1,22 +1,35 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
package org.apache.baremaps.raster;
-import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
+import javax.imageio.ImageIO;
public class Image {
- public static void main(String[] args) throws IOException {
- String urlString = String.format("https://s3.amazonaws.com/elevation-tiles-prod/geotiff/%s/%s/%s.tif", 14, 8492, 5792);
- URL url = new URL(urlString);
- BufferedImage tiffImage = ImageIO.read(url);
- var raster = tiffImage.getRaster();
- for (int x = 0; x < raster.getWidth(); x++) {
- for (int y = 0; y < raster.getHeight(); y++) {
- System.out.println(raster.getSampleFloat(y, y, 0));
- }
- }
+ public static void main(String[] args) throws IOException {
+ String urlString = String.format(
+ "https://s3.amazonaws.com/elevation-tiles-prod/geotiff/%s/%s/%s.tif", 14, 8492, 5792);
+ URL url = new URL(urlString);
+ BufferedImage tiffImage = ImageIO.read(url);
+ var raster = tiffImage.getRaster();
+ for (int x = 0; x < raster.getWidth(); x++) {
+ for (int y = 0; y < raster.getHeight(); y++) {
+ System.out.println(raster.getSampleFloat(y, y, 0));
+ }
}
+ }
}
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 3a12e7c9..0dfcea9c 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,7 @@ 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 +52,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 +67,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 +83,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 +96,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 +147,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 +164,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 +181,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 c54dedd1..9788595f 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,7 @@ 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 +51,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 +63,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 +89,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 +115,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 +130,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/VectorTileFunctions.java b/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileFunctions.java
index 16e96dce..6ff7c69c 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileFunctions.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/vectortile/VectorTileFunctions.java
@@ -87,11 +87,11 @@ public class VectorTileFunctions {
* @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();
+ .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/VectorTileFunctionsTest.java b/baremaps-core/src/test/java/org/apache/baremaps/vectortile/VectorTileFunctionsTest.java
index 84463543..bd297db2 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/vectortile/VectorTileFunctionsTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/vectortile/VectorTileFunctionsTest.java
@@ -40,7 +40,8 @@ class VectorTileFunctionsTest {
// Transform the input geometry into a vector tile geometry
var outputGeom =
- VectorTileFunctions.asVectorTileGeom(inputGeom, envelope.getEnvelopeInternal(), extent, buffer, clipGeom);
+ VectorTileFunctions.asVectorTileGeom(inputGeom, envelope.getEnvelopeInternal(), extent,
+ buffer, clipGeom);
// Check if the output geometry is not null
assertNotNull(outputGeom);
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..fa5320a4 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,6 @@ 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 +32,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 6d966b0d..ac7a3f53 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
@@ -48,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;
}