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/08/10 22:39:22 UTC

[incubator-baremaps] branch prepare-release created (now c860560b)

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

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


      at c860560b Add some scripts to prepare the release

This branch includes the following new commits:

     new c4bfb0e4 Reintroduce generic type for keys in maps
     new 8706ac3e Improve the collection api
     new e1e62cec Ignore example and basemap files
     new c860560b Add some scripts to prepare the release

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-baremaps] 02/04: Improve the collection api

Posted by bc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8706ac3e4385d776a6f4dbd6ad4e3bf1ca164778
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Fri Aug 11 00:36:57 2023 +0200

    Improve the collection api
---
 .../baremaps/openstreetmap/pbf/PbfBlockReader.java |  1 -
 .../baremaps/openstreetmap/pbf/PbfReader.java      | 20 ++++++------
 .../storage/postgres/PostgresDataSchema.java       |  1 -
 .../org/apache/baremaps/utils/SqliteUtils.java     |  9 +++--
 .../baremaps/workflow/tasks/ExportVectorTiles.java | 28 ++++++++++------
 .../workflow/tasks/ImportOpenStreetMap.java        | 38 +++++++++-------------
 .../apache/baremaps/workflow/ObjectMapperTest.java |  1 -
 7 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfBlockReader.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfBlockReader.java
index 5f99bb5a..ea701a6e 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfBlockReader.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfBlockReader.java
@@ -36,7 +36,6 @@ public class PbfBlockReader implements PbfReader<Block> {
 
   private DataMap<Long, List<Long>> referenceMap;
 
-
   @Override
   public int buffer() {
     return buffer;
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfReader.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfReader.java
index c7578308..4902f4a7 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfReader.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfReader.java
@@ -34,9 +34,9 @@ public interface PbfReader<T> extends OsmReader<T> {
    * Sets the number of blobs buffered by the parser to parallelize deserialization.
    *
    * @param buffer the size of the buffer
-   * @return the parser
+   * @return the reader
    */
-  PbfReader buffer(int buffer);
+  PbfReader<T> buffer(int buffer);
 
   /**
    * Gets the flag enabling the generation of geometries.
@@ -49,9 +49,9 @@ public interface PbfReader<T> extends OsmReader<T> {
    * Sets the flag enabling the generation of geometries.
    *
    * @param geometries the value of the flag
-   * @return the parser
+   * @return the reader
    */
-  PbfReader geometries(boolean geometries);
+  PbfReader<T> geometries(boolean geometries);
 
   /**
    * Gets the projection of the geometries generated by this parser.
@@ -64,9 +64,9 @@ public interface PbfReader<T> extends OsmReader<T> {
    * Sets the projection of the geometries generated by this parser.
    *
    * @param srid the projection of the geometries
-   * @return the parser
+   * @return the reader
    */
-  PbfReader projection(int srid);
+  PbfReader<T> projection(int srid);
 
   /**
    * Gets the map used to store coordinates for generating geometries.
@@ -79,9 +79,9 @@ public interface PbfReader<T> extends OsmReader<T> {
    * Sets the map used to store coordinates for generating geometries.
    *
    * @param coordinateMap the map of coordinates
-   * @return the parser
+   * @return the reader
    */
-  PbfReader coordinateMap(DataMap<Long, Coordinate> coordinateMap);
+  PbfReader<T> coordinateMap(DataMap<Long, Coordinate> coordinateMap);
 
   /**
    * Gets the map used to store references for generating geometries.
@@ -94,9 +94,9 @@ public interface PbfReader<T> extends OsmReader<T> {
    * Sets the map used to store references for generating geometries.
    *
    * @param referenceMap the map of references
-   * @return the parser
+   * @return the reader
    */
-  PbfReader referenceMap(DataMap<Long, List<Long>> referenceMap);
+  PbfReader<T> referenceMap(DataMap<Long, List<Long>> referenceMap);
 
   /**
    * Creates an ordered stream of osm objects.
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/storage/postgres/PostgresDataSchema.java b/baremaps-core/src/main/java/org/apache/baremaps/storage/postgres/PostgresDataSchema.java
index e21703c4..b4a21c42 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/storage/postgres/PostgresDataSchema.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/storage/postgres/PostgresDataSchema.java
@@ -213,7 +213,6 @@ public class PostgresDataSchema implements DataSchema {
         .map(column -> "\"" + column.name() + "\"")
         .collect(Collectors.joining(", ")));
     builder.append(") FROM STDIN BINARY");
-    System.out.println(builder.toString());
     return builder.toString();
   }
 
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/utils/SqliteUtils.java b/baremaps-core/src/main/java/org/apache/baremaps/utils/SqliteUtils.java
index f6ea9051..35e980ae 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/utils/SqliteUtils.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/utils/SqliteUtils.java
@@ -43,8 +43,9 @@ public final class SqliteUtils {
    * @param path the path to the SQLite database
    * @return the SQLite data source
    */
-  public static HikariDataSource createDataSource(Path path) {
+  public static HikariDataSource createDataSource(Path path, boolean readOnly) {
     var sqliteConfig = new SQLiteConfig();
+    sqliteConfig.setReadOnly(readOnly);
     sqliteConfig.setCacheSize(1000000);
     sqliteConfig.setPageSize(65536);
     sqliteConfig.setJournalMode(JournalMode.OFF);
@@ -54,11 +55,13 @@ public final class SqliteUtils {
 
     var sqliteDataSource = new SQLiteDataSource();
     sqliteDataSource.setConfig(sqliteConfig);
-    sqliteDataSource.setUrl("jdbc:sqlite:" + path);
+    sqliteDataSource.setUrl("jdbc:sqlite:" + path.toAbsolutePath());
+
+    System.out.println(path.toAbsolutePath());
 
     var hikariConfig = new HikariConfig();
     hikariConfig.setDataSource(sqliteDataSource);
-    hikariConfig.setMaximumPoolSize(1);
+    hikariConfig.setMaximumPoolSize(readOnly ? Runtime.getRuntime().availableProcessors() : 1);
 
     return new HikariDataSource(hikariConfig);
   }
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
index 5f3f4910..07c2a9ae 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
@@ -44,7 +44,12 @@ public record ExportVectorTiles(
     Path repository,
     int batchArraySize,
     int batchArrayIndex,
-    boolean mbtiles) implements Task {
+    Format format) implements Task {
+
+  public enum Format {
+    file,
+    mbtiles
+  }
 
   private static final Logger logger = LoggerFactory.getLogger(ExportVectorTiles.class);
 
@@ -77,15 +82,18 @@ public record ExportVectorTiles(
   }
 
   private TileStore targetTileStore(Tileset source) throws TileStoreException, IOException {
-    if (mbtiles) {
-      Files.deleteIfExists(repository);
-      var dataSource = SqliteUtils.createDataSource(repository);
-      var tilesStore = new MBTilesStore(dataSource);
-      tilesStore.initializeDatabase();
-      tilesStore.writeMetadata(metadata(source));
-      return tilesStore;
-    } else {
-      return new FileTileStore(repository);
+    switch (format) {
+      case file:
+        return new FileTileStore(repository);
+      case mbtiles:
+        Files.deleteIfExists(repository);
+        var dataSource = SqliteUtils.createDataSource(repository, false);
+        var tilesStore = new MBTilesStore(dataSource);
+        tilesStore.initializeDatabase();
+        tilesStore.writeMetadata(metadata(source));
+        return tilesStore;
+      default:
+        throw new IllegalArgumentException("Unsupported format");
     }
   }
 
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOpenStreetMap.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOpenStreetMap.java
index d30fcfc6..d33c403f 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOpenStreetMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOpenStreetMap.java
@@ -18,7 +18,7 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.List;
 import org.apache.baremaps.database.collection.*;
-import org.apache.baremaps.database.memory.MemoryMappedFile;
+import org.apache.baremaps.database.memory.MemoryMappedDirectory;
 import org.apache.baremaps.database.type.LongDataType;
 import org.apache.baremaps.database.type.LongListDataType;
 import org.apache.baremaps.database.type.PairDataType;
@@ -69,35 +69,27 @@ public record ImportOpenStreetMap(Path file, String database, Integer databaseSr
 
     var cacheDir = Files.createTempDirectory(Paths.get("."), "cache_");
 
-    DataMap<Long, Coordinate> coordinateMap;
-    if (Files.size(path) > 1 << 30) {
-      var coordinatesFile = Files.createFile(cacheDir.resolve("coordinates"));
-      coordinateMap = new MemoryAlignedDataMap<>(
-          new LonLatDataType(),
-          new MemoryMappedFile(coordinatesFile));
-    } else {
-      var coordinatesKeysFile = Files.createFile(cacheDir.resolve("coordinates_keys"));
-      var coordinatesValsFile = Files.createFile(cacheDir.resolve("coordinates_vals"));
-      coordinateMap =
-          new MonotonicDataMap<>(
-              new MemoryAlignedDataList<>(
-                  new PairDataType<>(new LongDataType(), new LongDataType()),
-                  new MemoryMappedFile(coordinatesKeysFile)),
-              new AppendOnlyBuffer<>(
-                  new LonLatDataType(),
-                  new MemoryMappedFile(coordinatesValsFile)));
-    }
+    var coordinateKeysDir = Files.createDirectories(cacheDir.resolve("coordinate_keys"));
+    var coordinateValuesDir = Files.createDirectories(cacheDir.resolve("coordinate_vals"));
+    var coordinateMap =
+        new MonotonicDataMap<>(
+            new MemoryAlignedDataList<>(
+                new PairDataType<>(new LongDataType(), new LongDataType()),
+                new MemoryMappedDirectory(coordinateKeysDir)),
+            new AppendOnlyBuffer<>(
+                new LonLatDataType(),
+                new MemoryMappedDirectory(coordinateValuesDir)));
 
-    var referencesKeysDir = Files.createFile(cacheDir.resolve("references_keys"));
-    var referencesValuesDir = Files.createFile(cacheDir.resolve("references_vals"));
+    var referenceKeysDir = Files.createDirectory(cacheDir.resolve("reference_keys"));
+    var referenceValuesDir = Files.createDirectory(cacheDir.resolve("reference_vals"));
     var referenceMap =
         new MonotonicDataMap<>(
             new MemoryAlignedDataList<>(
                 new PairDataType<>(new LongDataType(), new LongDataType()),
-                new MemoryMappedFile(referencesKeysDir)),
+                new MemoryMappedDirectory(referenceKeysDir)),
             new AppendOnlyBuffer<>(
                 new LongListDataType(),
-                new MemoryMappedFile(referencesValuesDir)));
+                new MemoryMappedDirectory(referenceValuesDir)));
 
     execute(
         path,
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/workflow/ObjectMapperTest.java b/baremaps-core/src/test/java/org/apache/baremaps/workflow/ObjectMapperTest.java
index 36f653ad..24d34d69 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/workflow/ObjectMapperTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/workflow/ObjectMapperTest.java
@@ -40,7 +40,6 @@ public class ObjectMapperTest {
                     "jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps",
                     3857)))));
     var json = mapper.writeValueAsString(workflow1);
-    System.out.println(json);
     assertTrue(json.contains(DownloadUrl.class.getSimpleName()));
     assertTrue(json.contains(ImportOpenStreetMap.class.getSimpleName()));
 


[incubator-baremaps] 01/04: Reintroduce generic type for keys in maps

Posted by bc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c4bfb0e400d9d037006aff02799832561d46b947
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Thu Aug 10 13:11:48 2023 +0200

    Reintroduce generic type for keys in maps
---
 .../baremaps/benchmarks/DataMapBenchmark.java      |  2 +-
 .../baremaps/benchmarks/MemoryBenchmark.java       |  2 +-
 .../OpenStreetMapGeometriesBenchmark.java          |  4 +--
 .../baremaps/database/collection/DataMap.java      | 32 +++++++++++-----------
 .../database/collection/IndexedDataMap.java        |  4 +--
 .../database/collection/MemoryAlignedDataMap.java  |  2 +-
 .../database/collection/MonotonicDataMap.java      |  2 +-
 .../collection/MonotonicFixedSizeDataMap.java      |  2 +-
 .../collection/MonotonicPairedDataMap.java         |  2 +-
 .../apache/baremaps/openstreetmap/DiffService.java |  7 +++--
 .../function/CoordinateMapBuilder.java             |  4 +--
 .../function/EntityGeometryBuilder.java            |  4 +--
 .../openstreetmap/function/GeometryMapBuilder.java |  4 +--
 .../function/ReferenceMapBuilder.java              |  4 +--
 .../function/RelationGeometryBuilder.java          |  8 +++---
 .../openstreetmap/function/WayGeometryBuilder.java |  4 +--
 .../baremaps/openstreetmap/pbf/PbfBlockReader.java | 12 ++++----
 .../openstreetmap/pbf/PbfEntityReader.java         |  8 +++---
 .../baremaps/openstreetmap/pbf/PbfReader.java      |  8 +++---
 .../postgres/PostgresCoordinateMap.java            |  2 +-
 .../postgres/PostgresReferenceMap.java             |  2 +-
 .../workflow/tasks/ImportOpenStreetMap.java        |  6 ++--
 .../workflow/tasks/UpdateOpenStreetMap.java        |  7 +++--
 .../org/apache/baremaps/database/DataMapTest.java  | 20 +++++++-------
 .../EntityDataTypeGeometryBuilderTest.java         |  4 +--
 .../geometry/RelationGeometryBuilderTest.java      |  4 +--
 .../baremaps/openstreetmap/store/MockDataMap.java  | 12 ++++----
 .../baremaps/workflow/tasks/ImportMonacoTest.java  |  4 +--
 .../workflow/tasks/ImportUpdateDataTest.java       |  4 +--
 .../tasks/ImportUpdateLiechtensteinTest.java       |  4 +--
 30 files changed, 93 insertions(+), 91 deletions(-)

diff --git a/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/DataMapBenchmark.java b/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/DataMapBenchmark.java
index 24b11931..da13e44f 100644
--- a/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/DataMapBenchmark.java
+++ b/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/DataMapBenchmark.java
@@ -31,7 +31,7 @@ public class DataMapBenchmark {
 
   private static final long N = 1 << 25;
 
-  private static void benchmark(DataMap<Long> map, long n) {
+  private static void benchmark(DataMap<Long, Long> map, long n) {
     for (long i = 0; i < n; i++) {
       map.put(i, i);
     }
diff --git a/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/MemoryBenchmark.java b/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/MemoryBenchmark.java
index e069ba2e..025b9eef 100644
--- a/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/MemoryBenchmark.java
+++ b/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/MemoryBenchmark.java
@@ -45,7 +45,7 @@ public class MemoryBenchmark {
 
   private static final long N = 1 << 25;
 
-  private void benchmark(DataMap<Long> map, long n) {
+  private void benchmark(DataMap<Long, Long> map, long n) {
     for (long i = 0; i < n; i++) {
       map.put(i, i);
     }
diff --git a/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/OpenStreetMapGeometriesBenchmark.java b/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/OpenStreetMapGeometriesBenchmark.java
index d517f463..d0097c70 100644
--- a/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/OpenStreetMapGeometriesBenchmark.java
+++ b/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/OpenStreetMapGeometriesBenchmark.java
@@ -75,9 +75,9 @@ public class OpenStreetMapGeometriesBenchmark {
   @Measurement(iterations = 3)
   public void store() throws IOException {
     Path file = Files.createTempFile(Paths.get("."), "baremaps_", ".tmp");
-    DataMap<Coordinate> coordinateMap = new IndexedDataMap<>(
+    DataMap<Long, Coordinate> coordinateMap = new IndexedDataMap<>(
         new AppendOnlyBuffer<>(new CoordinateDataType(), new MemoryMappedFile(file)));
-    DataMap<List<Long>> referenceMap =
+    DataMap<Long, List<Long>> referenceMap =
         new IndexedDataMap<>(new AppendOnlyBuffer<>(new LongListDataType(), new OnHeapMemory()));
     AtomicLong nodes = new AtomicLong(0);
     AtomicLong ways = new AtomicLong(0);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/database/collection/DataMap.java b/baremaps-core/src/main/java/org/apache/baremaps/database/collection/DataMap.java
index 7720bc51..4ac75d53 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/database/collection/DataMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/database/collection/DataMap.java
@@ -20,13 +20,13 @@ import java.util.*;
 /**
  * An abstract map of data elements that can hold a large number of elements.
  *
- * @param <E> The type of the elements.
+ * @param <V> The type of the elements.
  */
-public abstract class DataMap<E> implements Map<Long, E> {
+public abstract class DataMap<K, V> implements Map<K, V> {
 
   /** {@inheritDoc} */
   @Override
-  public void putAll(Map<? extends Long, ? extends E> m) {
+  public void putAll(Map<? extends K, ? extends V> m) {
     m.forEach(this::put);
   }
 
@@ -36,7 +36,7 @@ public abstract class DataMap<E> implements Map<Long, E> {
    * @param keys the keys
    * @return the values
    */
-  public List<E> getAll(List<Long> keys) {
+  public List<V> getAll(List<K> keys) {
     return Streams.stream(keys).map(this::get).toList();
   }
 
@@ -63,17 +63,17 @@ public abstract class DataMap<E> implements Map<Long, E> {
    *
    * @return an iterator
    */
-  protected abstract Iterator<Long> keyIterator();
+  protected abstract Iterator<K> keyIterator();
 
   /** {@inheritDoc} */
   @Override
-  public Set<Long> keySet() {
+  public Set<K> keySet() {
     return new KeySet();
   }
 
-  private class KeySet extends AbstractSet<Long> {
+  private class KeySet extends AbstractSet<K> {
     @Override
-    public Iterator<Long> iterator() {
+    public Iterator<K> iterator() {
       return keyIterator();
     }
 
@@ -88,17 +88,17 @@ public abstract class DataMap<E> implements Map<Long, E> {
    *
    * @return an iterator
    */
-  protected abstract Iterator<E> valueIterator();
+  protected abstract Iterator<V> valueIterator();
 
   /** {@inheritDoc} */
   @Override
-  public Collection<E> values() {
+  public Collection<V> values() {
     return new ValueCollection();
   }
 
-  private class ValueCollection extends AbstractCollection<E> {
+  private class ValueCollection extends AbstractCollection<V> {
     @Override
-    public Iterator<E> iterator() {
+    public Iterator<V> iterator() {
       return valueIterator();
     }
 
@@ -113,17 +113,17 @@ public abstract class DataMap<E> implements Map<Long, E> {
    *
    * @return an iterator
    */
-  protected abstract Iterator<Entry<Long, E>> entryIterator();
+  protected abstract Iterator<Entry<K, V>> entryIterator();
 
   /** {@inheritDoc} */
   @Override
-  public Set<Entry<Long, E>> entrySet() {
+  public Set<Entry<K, V>> entrySet() {
     return new EntrySet();
   }
 
-  private class EntrySet extends AbstractSet<Entry<Long, E>> {
+  private class EntrySet extends AbstractSet<Entry<K, V>> {
     @Override
-    public Iterator<Entry<Long, E>> iterator() {
+    public Iterator<Entry<K, V>> iterator() {
       return entryIterator();
     }
 
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/database/collection/IndexedDataMap.java b/baremaps-core/src/main/java/org/apache/baremaps/database/collection/IndexedDataMap.java
index 394e569e..9906a5d9 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/database/collection/IndexedDataMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/database/collection/IndexedDataMap.java
@@ -26,7 +26,7 @@ import java.util.Map;
  *
  * @param <E> The type of the elements.
  */
-public class IndexedDataMap<E> extends DataMap<E> {
+public class IndexedDataMap<E> extends DataMap<Long, E> {
 
   private final Map<Long, Long> index;
 
@@ -109,7 +109,7 @@ public class IndexedDataMap<E> extends DataMap<E> {
    */
   @Override
   public long sizeAsLong() {
-    if (index instanceof DataMap<Long>dataMap) {
+    if (index instanceof DataMap<?, ?>dataMap) {
       return dataMap.sizeAsLong();
     } else {
       return index.size();
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MemoryAlignedDataMap.java b/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MemoryAlignedDataMap.java
index f21331d3..5aa8b981 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MemoryAlignedDataMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MemoryAlignedDataMap.java
@@ -27,7 +27,7 @@ import org.apache.baremaps.database.type.FixedSizeDataType;
  * <p>
  * This code has been adapted from Planetiler (Apache license).
  */
-public class MemoryAlignedDataMap<E> extends DataMap<E> {
+public class MemoryAlignedDataMap<E> extends DataMap<Long, E> {
 
   private final FixedSizeDataType<E> dataType;
 
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicDataMap.java b/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicDataMap.java
index 4d0e32e2..26e50abb 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicDataMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicDataMap.java
@@ -31,7 +31,7 @@ import org.apache.baremaps.database.type.PairDataType.Pair;
  * <p>
  * Copyright (c) Planetiler.
  */
-public class MonotonicDataMap<E> extends DataMap<E> {
+public class MonotonicDataMap<E> extends DataMap<Long, E> {
 
   private final DataList<Long> offsets;
   private final DataList<Pair<Long, Long>> keys;
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicFixedSizeDataMap.java b/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicFixedSizeDataMap.java
index 59e7c5f6..e5ca5264 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicFixedSizeDataMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicFixedSizeDataMap.java
@@ -30,7 +30,7 @@ import org.apache.baremaps.database.type.LongDataType;
  * <p>
  * Copyright (c) Planetiler.
  */
-public class MonotonicFixedSizeDataMap<E> extends DataMap<E> {
+public class MonotonicFixedSizeDataMap<E> extends DataMap<Long, E> {
 
   private final DataList<Long> offsets;
   private final DataList<Long> keys;
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicPairedDataMap.java b/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicPairedDataMap.java
index 60100f85..1f618eb8 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicPairedDataMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/database/collection/MonotonicPairedDataMap.java
@@ -24,7 +24,7 @@ import org.apache.baremaps.database.type.PairDataType.Pair;
  * their key and inserted in a monotonic way. The elements cannot be removed or updated once
  * inserted.
  */
-public class MonotonicPairedDataMap<E> extends DataMap<E> {
+public class MonotonicPairedDataMap<E> extends DataMap<Long, E> {
 
   private final DataList<Long> offsets;
   private final MemoryAlignedDataList<Pair<Long, E>> values;
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/DiffService.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/DiffService.java
index 86a085c1..ec6019f1 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/DiffService.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/DiffService.java
@@ -45,8 +45,8 @@ public class DiffService implements Callable<List<TileCoord>> {
 
   private static final Logger logger = LoggerFactory.getLogger(DiffService.class);
 
-  private final DataMap<Coordinate> coordinateMap;
-  private final DataMap<List<Long>> referenceMap;
+  private final DataMap<Long, Coordinate> coordinateMap;
+  private final DataMap<Long, List<Long>> referenceMap;
   private final HeaderRepository headerRepository;
   private final Repository<Long, Node> nodeRepository;
   private final Repository<Long, Way> wayRepository;
@@ -54,7 +54,8 @@ public class DiffService implements Callable<List<TileCoord>> {
   private final int srid;
   private final int zoom;
 
-  public DiffService(DataMap<Coordinate> coordinateMap, DataMap<List<Long>> referenceMap,
+  public DiffService(DataMap<Long, Coordinate> coordinateMap,
+      DataMap<Long, List<Long>> referenceMap,
       HeaderRepository headerRepository, Repository<Long, Node> nodeRepository,
       Repository<Long, Way> wayRepository, Repository<Long, Relation> relationRepository, int srid,
       int zoom) {
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/CoordinateMapBuilder.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/CoordinateMapBuilder.java
index 5b6dbf1c..8dec05d8 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/CoordinateMapBuilder.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/CoordinateMapBuilder.java
@@ -23,14 +23,14 @@ import org.locationtech.jts.geom.Coordinate;
 /** A consumer that stores openstreetmap coordinates in a map. */
 public class CoordinateMapBuilder implements Consumer<Entity> {
 
-  private final DataMap<Coordinate> coordinateMap;
+  private final DataMap<Long, Coordinate> coordinateMap;
 
   /**
    * Constructs a {@code CacheBlockConsumer} with the provided map.
    *
    * @param coordinateMap the map of coordinates
    */
-  public CoordinateMapBuilder(DataMap<Coordinate> coordinateMap) {
+  public CoordinateMapBuilder(DataMap<Long, Coordinate> coordinateMap) {
     this.coordinateMap = coordinateMap;
   }
 
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/EntityGeometryBuilder.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/EntityGeometryBuilder.java
index 2ff4dafc..1d2b6446 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/EntityGeometryBuilder.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/EntityGeometryBuilder.java
@@ -36,8 +36,8 @@ public class EntityGeometryBuilder implements Consumer<Entity> {
    * @param coordinateMap the coordinate cache
    * @param referenceMap the reference cache
    */
-  public EntityGeometryBuilder(DataMap<Coordinate> coordinateMap,
-      DataMap<List<Long>> referenceMap) {
+  public EntityGeometryBuilder(DataMap<Long, Coordinate> coordinateMap,
+      DataMap<Long, List<Long>> referenceMap) {
     this.nodeGeometryBuilder = new NodeGeometryBuilder();
     this.wayGeometryBuilder = new WayGeometryBuilder(coordinateMap);
     this.relationGeometryBuilder = new RelationGeometryBuilder(coordinateMap, referenceMap);
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/GeometryMapBuilder.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/GeometryMapBuilder.java
index b72782e9..1cd084db 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/GeometryMapBuilder.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/GeometryMapBuilder.java
@@ -26,7 +26,7 @@ import org.locationtech.jts.geom.Geometry;
  */
 public class GeometryMapBuilder implements Consumer<Entity> {
 
-  private final DataMap<Geometry> geometryMap;
+  private final DataMap<Long, Geometry> geometryMap;
 
   private final Predicate<Entity> filter;
 
@@ -36,7 +36,7 @@ public class GeometryMapBuilder implements Consumer<Entity> {
    * @param geometryMap the geometry map
    * @param filter the entity filter
    */
-  public GeometryMapBuilder(DataMap<Geometry> geometryMap, Predicate<Entity> filter) {
+  public GeometryMapBuilder(DataMap<Long, Geometry> geometryMap, Predicate<Entity> filter) {
     this.geometryMap = geometryMap;
     this.filter = filter;
   }
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/ReferenceMapBuilder.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/ReferenceMapBuilder.java
index d7c880ed..3f9987b5 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/ReferenceMapBuilder.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/ReferenceMapBuilder.java
@@ -23,14 +23,14 @@ import org.apache.baremaps.openstreetmap.model.Way;
 /** A consumer that stores openstreetmap references in a map. */
 public class ReferenceMapBuilder implements Consumer<Entity> {
 
-  private final DataMap<List<Long>> referenceMap;
+  private final DataMap<Long, List<Long>> referenceMap;
 
   /**
    * Constructs a {@code CacheBlockConsumer} with the provided map.
    *
    * @param referenceMap the map of references
    */
-  public ReferenceMapBuilder(DataMap<List<Long>> referenceMap) {
+  public ReferenceMapBuilder(DataMap<Long, List<Long>> referenceMap) {
     this.referenceMap = referenceMap;
   }
 
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/RelationGeometryBuilder.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/RelationGeometryBuilder.java
index 096e30be..1ca50afe 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/RelationGeometryBuilder.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/RelationGeometryBuilder.java
@@ -36,8 +36,8 @@ public class RelationGeometryBuilder implements Consumer<Relation> {
 
   private static final Logger logger = LoggerFactory.getLogger(RelationGeometryBuilder.class);
 
-  private final DataMap<Coordinate> coordinateMap;
-  private final DataMap<List<Long>> referenceMap;
+  private final DataMap<Long, Coordinate> coordinateMap;
+  private final DataMap<Long, List<Long>> referenceMap;
 
   /**
    * Constructs a relation geometry builder.
@@ -45,8 +45,8 @@ public class RelationGeometryBuilder implements Consumer<Relation> {
    * @param coordinateMap the coordinates map
    * @param referenceMap the references map
    */
-  public RelationGeometryBuilder(DataMap<Coordinate> coordinateMap,
-      DataMap<List<Long>> referenceMap) {
+  public RelationGeometryBuilder(DataMap<Long, Coordinate> coordinateMap,
+      DataMap<Long, List<Long>> referenceMap) {
     this.coordinateMap = coordinateMap;
     this.referenceMap = referenceMap;
   }
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/WayGeometryBuilder.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/WayGeometryBuilder.java
index 299ec5f7..a3d9b1cd 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/WayGeometryBuilder.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/function/WayGeometryBuilder.java
@@ -31,14 +31,14 @@ public class WayGeometryBuilder implements Consumer<Way> {
 
   private static final Logger logger = LoggerFactory.getLogger(WayGeometryBuilder.class);
 
-  private final DataMap<Coordinate> coordinateMap;
+  private final DataMap<Long, Coordinate> coordinateMap;
 
   /**
    * Constructs a way geometry builder.
    *
    * @param coordinateMap the coordinates map
    */
-  public WayGeometryBuilder(DataMap<Coordinate> coordinateMap) {
+  public WayGeometryBuilder(DataMap<Long, Coordinate> coordinateMap) {
     this.coordinateMap = coordinateMap;
   }
 
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfBlockReader.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfBlockReader.java
index 79affe43..5f99bb5a 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfBlockReader.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfBlockReader.java
@@ -32,9 +32,9 @@ public class PbfBlockReader implements PbfReader<Block> {
 
   private int srid = 4326;
 
-  private DataMap<Coordinate> coordinateMap;
+  private DataMap<Long, Coordinate> coordinateMap;
 
-  private DataMap<List<Long>> referenceMap;
+  private DataMap<Long, List<Long>> referenceMap;
 
 
   @Override
@@ -75,23 +75,23 @@ public class PbfBlockReader implements PbfReader<Block> {
   }
 
   @Override
-  public DataMap<Coordinate> coordinateMap() {
+  public DataMap<Long, Coordinate> coordinateMap() {
     return coordinateMap;
   }
 
   @Override
-  public PbfBlockReader coordinateMap(DataMap<Coordinate> coordinateMap) {
+  public PbfBlockReader coordinateMap(DataMap<Long, Coordinate> coordinateMap) {
     this.coordinateMap = coordinateMap;
     return this;
   }
 
   @Override
-  public DataMap<List<Long>> referenceMap() {
+  public DataMap<Long, List<Long>> referenceMap() {
     return referenceMap;
   }
 
   @Override
-  public PbfBlockReader referenceMap(DataMap<List<Long>> referenceMap) {
+  public PbfBlockReader referenceMap(DataMap<Long, List<Long>> referenceMap) {
     this.referenceMap = referenceMap;
     return this;
   }
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfEntityReader.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfEntityReader.java
index 3fb7db28..57f6ef6d 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfEntityReader.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfEntityReader.java
@@ -70,23 +70,23 @@ public class PbfEntityReader implements PbfReader<Entity> {
   }
 
   @Override
-  public DataMap<Coordinate> coordinateMap() {
+  public DataMap<Long, Coordinate> coordinateMap() {
     return reader.coordinateMap();
   }
 
   @Override
-  public PbfEntityReader coordinateMap(DataMap<Coordinate> coordinateMap) {
+  public PbfEntityReader coordinateMap(DataMap<Long, Coordinate> coordinateMap) {
     reader.coordinateMap(coordinateMap);
     return this;
   }
 
   @Override
-  public DataMap<List<Long>> referenceMap() {
+  public DataMap<Long, List<Long>> referenceMap() {
     return reader.referenceMap();
   }
 
   @Override
-  public PbfEntityReader referenceMap(DataMap<List<Long>> referenceMap) {
+  public PbfEntityReader referenceMap(DataMap<Long, List<Long>> referenceMap) {
     reader.referenceMap(referenceMap);
     return this;
   }
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfReader.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfReader.java
index 7a515ff8..c7578308 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfReader.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/pbf/PbfReader.java
@@ -73,7 +73,7 @@ public interface PbfReader<T> extends OsmReader<T> {
    *
    * @return the map of coordinates
    */
-  DataMap<Coordinate> coordinateMap();
+  DataMap<Long, Coordinate> coordinateMap();
 
   /**
    * Sets the map used to store coordinates for generating geometries.
@@ -81,14 +81,14 @@ public interface PbfReader<T> extends OsmReader<T> {
    * @param coordinateMap the map of coordinates
    * @return the parser
    */
-  PbfReader coordinateMap(DataMap<Coordinate> coordinateMap);
+  PbfReader coordinateMap(DataMap<Long, Coordinate> coordinateMap);
 
   /**
    * Gets the map used to store references for generating geometries.
    *
    * @return the map of references
    */
-  DataMap<List<Long>> referenceMap();
+  DataMap<Long, List<Long>> referenceMap();
 
   /**
    * Sets the map used to store references for generating geometries.
@@ -96,7 +96,7 @@ public interface PbfReader<T> extends OsmReader<T> {
    * @param referenceMap the map of references
    * @return the parser
    */
-  PbfReader referenceMap(DataMap<List<Long>> referenceMap);
+  PbfReader referenceMap(DataMap<Long, List<Long>> referenceMap);
 
   /**
    * Creates an ordered stream of osm objects.
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/postgres/PostgresCoordinateMap.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/postgres/PostgresCoordinateMap.java
index 9da22933..a4fe9944 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/postgres/PostgresCoordinateMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/postgres/PostgresCoordinateMap.java
@@ -24,7 +24,7 @@ import org.locationtech.jts.geom.Coordinate;
 /**
  * A read-only {@link DataMap} for coordinates baked by OpenStreetMap nodes stored in PostgreSQL.
  */
-public class PostgresCoordinateMap extends DataMap<Coordinate> {
+public class PostgresCoordinateMap extends DataMap<Long, Coordinate> {
 
   public static final String SELECT_CONTAINS_KEY = """
       SELECT 1
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/postgres/PostgresReferenceMap.java b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/postgres/PostgresReferenceMap.java
index 77c175e5..bf6707dd 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/postgres/PostgresReferenceMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/postgres/PostgresReferenceMap.java
@@ -27,7 +27,7 @@ import org.apache.baremaps.database.collection.DataMap;
 /**
  * A read-only {@code LongDataMap} for references baked by OpenStreetMap ways stored in Postgres.
  */
-public class PostgresReferenceMap extends DataMap<List<Long>> {
+public class PostgresReferenceMap extends DataMap<Long, List<Long>> {
 
   public static final String SELECT_CONTAINS_KEY = """
       SELECT 1
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOpenStreetMap.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOpenStreetMap.java
index b7053a70..d30fcfc6 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOpenStreetMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOpenStreetMap.java
@@ -69,7 +69,7 @@ public record ImportOpenStreetMap(Path file, String database, Integer databaseSr
 
     var cacheDir = Files.createTempDirectory(Paths.get("."), "cache_");
 
-    DataMap<Coordinate> coordinateMap;
+    DataMap<Long, Coordinate> coordinateMap;
     if (Files.size(path) > 1 << 30) {
       var coordinatesFile = Files.createFile(cacheDir.resolve("coordinates"));
       coordinateMap = new MemoryAlignedDataMap<>(
@@ -114,8 +114,8 @@ public record ImportOpenStreetMap(Path file, String database, Integer databaseSr
 
   public static void execute(
       Path path,
-      DataMap<Coordinate> coordinateMap,
-      DataMap<List<Long>> referenceMap,
+      DataMap<Long, Coordinate> coordinateMap,
+      DataMap<Long, List<Long>> referenceMap,
       HeaderRepository headerRepository,
       Repository<Long, Node> nodeRepository,
       Repository<Long, Way> wayRepository,
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOpenStreetMap.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOpenStreetMap.java
index dd05a4b8..6b7babb5 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOpenStreetMap.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/UpdateOpenStreetMap.java
@@ -51,8 +51,8 @@ public record UpdateOpenStreetMap(String database, Integer databaseSrid) impleme
   @Override
   public void execute(WorkflowContext context) throws Exception {
     var datasource = context.getDataSource(database);
-    DataMap<Coordinate> coordinateMap = new PostgresCoordinateMap(datasource);
-    DataMap<List<Long>> referenceMap = new PostgresReferenceMap(datasource);
+    DataMap<Long, Coordinate> coordinateMap = new PostgresCoordinateMap(datasource);
+    DataMap<Long, List<Long>> referenceMap = new PostgresReferenceMap(datasource);
     HeaderRepository headerRepository = new PostgresHeaderRepository(datasource);
     Repository<Long, Node> nodeRepository = new PostgresNodeRepository(datasource);
     Repository<Long, Way> wayRepository = new PostgresWayRepository(datasource);
@@ -67,7 +67,8 @@ public record UpdateOpenStreetMap(String database, Integer databaseSrid) impleme
         databaseSrid);
   }
 
-  public static void execute(DataMap<Coordinate> coordinateMap, DataMap<List<Long>> referenceMap,
+  public static void execute(DataMap<Long, Coordinate> coordinateMap,
+      DataMap<Long, List<Long>> referenceMap,
       HeaderRepository headerRepository, Repository<Long, Node> nodeRepository,
       Repository<Long, Way> wayRepository, Repository<Long, Relation> relationRepository,
       int srid) throws Exception {
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/database/DataMapTest.java b/baremaps-core/src/test/java/org/apache/baremaps/database/DataMapTest.java
index 0ccac5c5..4fefe63f 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/database/DataMapTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/database/DataMapTest.java
@@ -29,7 +29,7 @@ class DataMapTest {
 
   @ParameterizedTest
   @MethodSource("mapProvider")
-  void putAndGet(DataMap<Long> map) {
+  void putAndGet(DataMap<Long, Long> map) {
     for (long i = 0; i < 1000; i++) {
       map.put(i, i * 2);
     }
@@ -40,7 +40,7 @@ class DataMapTest {
 
   @ParameterizedTest
   @MethodSource("mapProvider")
-  void containsKey(DataMap<Long> map) {
+  void containsKey(DataMap<Long, Long> map) {
     for (long i = 0; i < 1000; i++) {
       assertFalse(map.containsKey(i));
     }
@@ -54,7 +54,7 @@ class DataMapTest {
 
   @ParameterizedTest
   @MethodSource("mapProvider")
-  void containsValue(DataMap<Long> map) {
+  void containsValue(DataMap<Long, Long> map) {
     for (long i = 0; i < 1000; i++) {
       assertFalse(map.containsValue(i));
     }
@@ -68,7 +68,7 @@ class DataMapTest {
 
   @ParameterizedTest
   @MethodSource("mapProvider")
-  void getAll(DataMap<Long> map) {
+  void getAll(DataMap<Long, Long> map) {
     for (long i = 0; i < 1000; i++) {
       map.put(i, i);
     }
@@ -83,7 +83,7 @@ class DataMapTest {
 
   @ParameterizedTest
   @MethodSource("mapProvider")
-  void size(DataMap<Long> map) {
+  void size(DataMap<Long, Long> map) {
     for (long i = 0; i < 1000; i++) {
       map.put(i, i);
     }
@@ -94,7 +94,7 @@ class DataMapTest {
 
   @ParameterizedTest
   @MethodSource("mapProvider")
-  void keySet(DataMap<Long> map) {
+  void keySet(DataMap<Long, Long> map) {
     var set = new HashSet<Long>();
     for (long i = 0; i < 1000; i++) {
       set.add(i);
@@ -106,7 +106,7 @@ class DataMapTest {
 
   @ParameterizedTest
   @MethodSource("mapProvider")
-  void valueSet(DataMap<Long> map) {
+  void valueSet(DataMap<Long, Long> map) {
     var set = new HashSet<Long>();
     for (long i = 0; i < 1000; i++) {
       set.add(i);
@@ -117,7 +117,7 @@ class DataMapTest {
 
   @ParameterizedTest
   @MethodSource("mapProvider")
-  void entrySet(DataMap<Long> map) {
+  void entrySet(DataMap<Long, Long> map) {
     var set = new HashSet<Entry<Long, Long>>();
     for (long i = 0; i < 1000; i++) {
       set.add(Map.entry(i, i));
@@ -128,7 +128,7 @@ class DataMapTest {
 
   @ParameterizedTest
   @MethodSource("mapProvider")
-  void isEmpty(DataMap<Long> map) {
+  void isEmpty(DataMap<Long, Long> map) {
     assertTrue(map.isEmpty());
     map.put(0l, 0l);
     assertFalse(map.isEmpty());
@@ -136,7 +136,7 @@ class DataMapTest {
 
   @ParameterizedTest
   @MethodSource("mapProvider")
-  void map(DataMap<Long> map) {
+  void map(DataMap<Long, Long> map) {
     assertTrue(map.isEmpty());
 
     map.put(10l, 10l);
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/geometry/EntityDataTypeGeometryBuilderTest.java b/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/geometry/EntityDataTypeGeometryBuilderTest.java
index 8f744ede..1b4ef30c 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/geometry/EntityDataTypeGeometryBuilderTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/geometry/EntityDataTypeGeometryBuilderTest.java
@@ -107,7 +107,7 @@ class EntityDataTypeGeometryBuilderTest {
 
   static final Node NODE_15 = new Node(15, INFO, ImmutableMap.of(), 3, 1);
 
-  static final DataMap<Coordinate> COORDINATE_CACHE = new MockDataMap(Arrays
+  static final DataMap<Long, Coordinate> COORDINATE_CACHE = new MockDataMap(Arrays
       .asList(NODE_0, NODE_1, NODE_2, NODE_3, NODE_4, NODE_5, NODE_6, NODE_7, NODE_8, NODE_9,
           NODE_10, NODE_11, NODE_12, NODE_13, NODE_14, NODE_15)
       .stream()
@@ -129,7 +129,7 @@ class EntityDataTypeGeometryBuilderTest {
   static final Way WAY_5 =
       new Way(5, INFO, ImmutableMap.of(), ImmutableList.of(12l, 13l, 14l, 15l, 12l));
 
-  static final DataMap<List<Long>> REFERENCE_CACHE =
+  static final DataMap<Long, List<Long>> REFERENCE_CACHE =
       new MockDataMap(Arrays.asList(WAY_0, WAY_1, WAY_2, WAY_3, WAY_4, WAY_5).stream()
           .collect(Collectors.toMap(w -> w.id(), w -> w.getNodes())));
 
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/geometry/RelationGeometryBuilderTest.java b/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/geometry/RelationGeometryBuilderTest.java
index fd6224fc..5ba43698 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/geometry/RelationGeometryBuilderTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/geometry/RelationGeometryBuilderTest.java
@@ -37,10 +37,10 @@ class RelationGeometryBuilderTest {
   Geometry handleRelation(String file) throws IOException {
     InputStream input = new GZIPInputStream(this.getClass().getResourceAsStream(file));
     List<Entity> entities = new XmlEntityReader().stream(input).toList();
-    DataMap<Coordinate> coordinateMap = new MockDataMap<>(
+    DataMap<Long, Coordinate> coordinateMap = new MockDataMap<>(
         entities.stream().filter(e -> e instanceof Node).map(e -> (Node) e).collect(
             Collectors.toMap(n -> n.id(), n -> new Coordinate(n.getLon(), n.getLat()))));
-    DataMap<List<Long>> referenceMap =
+    DataMap<Long, List<Long>> referenceMap =
         new MockDataMap<>(entities.stream().filter(e -> e instanceof Way).map(e -> (Way) e)
             .collect(Collectors.toMap(w -> w.id(), w -> w.getNodes())));
     Relation relation = entities.stream().filter(e -> e instanceof Relation).map(e -> (Relation) e)
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/store/MockDataMap.java b/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/store/MockDataMap.java
index 01fba4d6..6f3e37f2 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/store/MockDataMap.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/openstreetmap/store/MockDataMap.java
@@ -19,16 +19,16 @@ import java.util.Map;
 import org.apache.baremaps.database.collection.DataMap;
 import org.jetbrains.annotations.Nullable;
 
-public class MockDataMap<T> extends DataMap<T> {
+public class MockDataMap<K, T> extends DataMap<K, T> {
 
-  private final Map<Long, T> values;
+  private final Map<K, T> values;
 
-  public MockDataMap(Map<Long, T> values) {
+  public MockDataMap(Map<K, T> values) {
     this.values = values;
   }
 
   @Override
-  protected Iterator<Long> keyIterator() {
+  protected Iterator<K> keyIterator() {
     return values.keySet().iterator();
   }
 
@@ -38,7 +38,7 @@ public class MockDataMap<T> extends DataMap<T> {
   }
 
   @Override
-  protected Iterator<Entry<Long, T>> entryIterator() {
+  protected Iterator<Entry<K, T>> entryIterator() {
     return values.entrySet().iterator();
   }
 
@@ -64,7 +64,7 @@ public class MockDataMap<T> extends DataMap<T> {
 
   @Nullable
   @Override
-  public T put(Long key, T value) {
+  public T put(K key, T value) {
     return values.put(key, value);
   }
 
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportMonacoTest.java b/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportMonacoTest.java
index 4ac44277..aa5d26b5 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportMonacoTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportMonacoTest.java
@@ -46,9 +46,9 @@ class ImportMonacoTest extends PostgresRepositoryTest {
     PostgresWayRepository wayRepository = new PostgresWayRepository(dataSource());
     PostgresRelationRepository relationRepository = new PostgresRelationRepository(dataSource());
 
-    DataMap<Coordinate> coordinateMap =
+    DataMap<Long, Coordinate> coordinateMap =
         new IndexedDataMap<>(new AppendOnlyBuffer<>(new CoordinateDataType(), new OnHeapMemory()));
-    DataMap<List<Long>> referenceMap =
+    DataMap<Long, List<Long>> referenceMap =
         new IndexedDataMap<>(new AppendOnlyBuffer<>(new LongListDataType(), new OnHeapMemory()));
 
     // Import data
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateDataTest.java b/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateDataTest.java
index 42b767a9..ff23d891 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateDataTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateDataTest.java
@@ -50,9 +50,9 @@ class ImportUpdateDataTest extends PostgresRepositoryTest {
     PostgresWayRepository wayRepository = new PostgresWayRepository(dataSource());
     PostgresRelationRepository relationRepository = new PostgresRelationRepository(dataSource());
 
-    DataMap<Coordinate> coordinateMap =
+    DataMap<Long, Coordinate> coordinateMap =
         new IndexedDataMap<>(new AppendOnlyBuffer<>(new CoordinateDataType(), new OnHeapMemory()));
-    DataMap<List<Long>> referenceMap =
+    DataMap<Long, List<Long>> referenceMap =
         new IndexedDataMap<>(new AppendOnlyBuffer<>(new LongListDataType(), new OnHeapMemory()));
 
     // Import data
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateLiechtensteinTest.java b/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateLiechtensteinTest.java
index b255ee5b..fd1e23c6 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateLiechtensteinTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/workflow/tasks/ImportUpdateLiechtensteinTest.java
@@ -47,9 +47,9 @@ class ImportUpdateLiechtensteinTest extends PostgresRepositoryTest {
     PostgresWayRepository wayRepository = new PostgresWayRepository(dataSource());
     PostgresRelationRepository relationRepository = new PostgresRelationRepository(dataSource());
 
-    DataMap<Coordinate> coordinateMap =
+    DataMap<Long, Coordinate> coordinateMap =
         new IndexedDataMap<>(new AppendOnlyBuffer<>(new CoordinateDataType(), new OnHeapMemory()));
-    DataMap<List<Long>> referenceMap =
+    DataMap<Long, List<Long>> referenceMap =
         new IndexedDataMap<>(new AppendOnlyBuffer<>(new LongListDataType(), new OnHeapMemory()));
 
     // Import data


[incubator-baremaps] 04/04: Add some scripts to prepare the release

Posted by bc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c860560b8a0501706bca9af8a1ff40c016a6f38c
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Fri Aug 11 00:37:57 2023 +0200

    Add some scripts to prepare the release
---
 scripts/build-project.sh   |  40 ++++++++++++++
 scripts/generate-planet.sh |  37 +++++++++++++
 scripts/test-basemap.sh    |  70 +++++++++++++++++++++++++
 scripts/test-examples.sh   | 127 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 274 insertions(+)

diff --git a/scripts/build-project.sh b/scripts/build-project.sh
new file mode 100755
index 00000000..3da24e12
--- /dev/null
+++ b/scripts/build-project.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# 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.
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Build the project"
+echo "--------------------------------------------------------------------"
+echo ""
+
+cd ..
+./mvnw spotless:apply clean install -DskipTests
+rm -fr baremaps
+tar -xvf ./baremaps-cli/target/apache-baremaps-0.7.2-SNAPSHOT-incubating-bin.tar.gz -C target/
+mv ./target/apache-baremaps-0.7.2-SNAPSHOT-incubating-bin ./baremaps
+export PATH=$PATH:`pwd`/baremaps/bin
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Display the path of the baremaps executable"
+echo "--------------------------------------------------------------------"
+echo ""
+
+which baremaps
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Display the version of the baremaps executable"
+echo "--------------------------------------------------------------------"
+echo ""
+
+baremaps --version
diff --git a/scripts/generate-planet.sh b/scripts/generate-planet.sh
new file mode 100755
index 00000000..cb1f244e
--- /dev/null
+++ b/scripts/generate-planet.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# 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.
+
+cd ../basemap
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Execute the Basemap workflow"
+echo "--------------------------------------------------------------------"
+echo ""
+
+rm -fr data tiles tiles.mbtiles
+
+awk '{gsub("https://download.geofabrik.de/europe/switzerland-latest.osm.pbf", "https://planet.openstreetmap.org/pbf/planet-latest.osm.pbf"); print}' config.js > tmpfile && mv tmpfile config.js
+awk '{gsub("6.02260949059, 45.7769477403, 10.4427014502, 47.8308275417", "-180, -90, 180, 90"); print}' config.js > tmpfile && mv tmpfile config.js
+
+baremaps workflow execute --file workflow.js > workflow.log
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Export the Basemap tiles"
+echo "--------------------------------------------------------------------"
+echo ""
+
+baremaps map export \
+  --tileset 'tileset.js' \
+  --repository 'tiles.mbtiles' \
+  --format mbtiles > export.log
diff --git a/scripts/test-basemap.sh b/scripts/test-basemap.sh
new file mode 100755
index 00000000..6c9aaad8
--- /dev/null
+++ b/scripts/test-basemap.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# 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.
+
+cd ../basemap
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Execute the Basemap workflow"
+echo "--------------------------------------------------------------------"
+echo ""
+
+rm -fr data tiles tiles.mbtiles
+
+baremaps workflow execute --file workflow.js
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Start the Basemap server"
+echo "--------------------------------------------------------------------"
+echo ""
+
+nohup baremaps map dev --tileset 'tileset.js' --style 'style.js' > /dev/null 2>&1 &
+sleep 1
+baremaps=$!
+
+echo "Get the status of the root (/):"
+curl -I http://localhost:9000/
+
+echo "Get the status of the style (/style.json):"
+curl -I http://localhost:9000/style.json
+
+echo "Get the status of the tileset (/tiles.json):"
+curl -I http://localhost:9000/tiles.json
+
+echo "Get the status of a tile (/tiles/14/8625/5746.mvt):"
+curl -I http://localhost:9000/tiles/1/1/1.mvt
+
+echo "Get the status of an out-of-bound tile (/tiles/16/16398/10986.mvt):"
+curl -I http://localhost:9000/tiles/16/16398/10986.mvt
+
+kill $baremaps
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Export the Basemap tiles"
+echo "--------------------------------------------------------------------"
+echo ""
+
+baremaps map export \
+  --tileset 'tileset.js' \
+  --repository 'tiles/' \
+  --format file
+
+du -h tiles
+
+baremaps map export \
+  --tileset 'tileset.js' \
+  --repository 'tiles.mbtiles' \
+  --format mbtiles
+
+du -h tiles.mbtiles
diff --git a/scripts/test-examples.sh b/scripts/test-examples.sh
new file mode 100755
index 00000000..a0ed83ea
--- /dev/null
+++ b/scripts/test-examples.sh
@@ -0,0 +1,127 @@
+#!/bin/sh
+
+# 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.
+
+cd ../examples/openstreetmap
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Execute the OpenStreetMap workflow"
+echo "--------------------------------------------------------------------"
+echo ""
+
+baremaps workflow execute --file workflow.json
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Start the OpenStreetMap server"
+echo "--------------------------------------------------------------------"
+echo ""
+
+nohup baremaps map dev --tileset 'tileset.json' --style 'style.json' > /dev/null 2>&1 &
+sleep 1
+baremaps=$!
+
+echo "Get the status of the root (/):"
+curl -I http://localhost:9000/
+
+echo "Get the status of the style (/style.json):"
+curl -I http://localhost:9000/style.json
+
+echo "Get the status of the tileset (/tiles.json):"
+curl -I http://localhost:9000/tiles.json
+
+echo "Get the status of a tile (/tiles/14/8625/5746.mvt):"
+curl -I http://localhost:9000/tiles/14/8625/5746.mvt
+
+echo "Get the status of an out-of-bound tile (/tiles/16/16398/10986.mvt):"
+curl -I http://localhost:9000/tiles/16/16398/10986.mvt
+
+kill $baremaps
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Export the OpenStreetMap tiles (directory)"
+echo "--------------------------------------------------------------------"
+echo ""
+
+baremaps map export \
+  --tileset 'tileset.json' \
+  --repository 'tiles/'
+
+echo "Display the size of the tiles:"
+du -a tiles
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Export the OpenStreetMap tiles (mbtiles)"
+echo "--------------------------------------------------------------------"
+echo ""
+
+baremaps map export \
+  --tileset 'tileset.json' \
+  --repository 'tiles.mbtiles' \
+  --format mbtiles
+
+echo "Display the size of the tiles:"
+du -a tiles.mbtiles
+
+cd ../..
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Execute the NaturalEarth workflow"
+echo "--------------------------------------------------------------------"
+echo ""
+
+cd examples/naturalearth
+
+baremaps workflow execute --file workflow.json
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Start the NaturalEarth server"
+echo "--------------------------------------------------------------------"
+echo ""
+
+nohup baremaps map dev --tileset 'tileset.json' --style 'style.json' > /dev/null 2>&1 &
+sleep 1
+baremaps=$!
+
+echo "Get the status of the root (/):"
+curl -I http://localhost:9000/
+
+echo "Get the status of the style (/style.json):"
+curl -I http://localhost:9000/style.json
+
+echo "Get the status of the tileset (/tiles.json):"
+curl -I http://localhost:9000/tiles.json
+
+echo "Get the status of a tile (/tiles/14/8625/5746.mvt):"
+curl -I http://localhost:9000/tiles/1/1/1.mvt
+
+echo "Get the status of an out-of-bound tile (/tiles/16/16398/10986.mvt):"
+curl -I http://localhost:9000/tiles/16/16398/10986.mvt
+
+kill $baremaps
+
+echo ""
+echo "--------------------------------------------------------------------"
+echo "Export the NaturalEarth tiles"
+echo "--------------------------------------------------------------------"
+echo ""
+
+baremaps map export \
+  --tileset 'tileset.json' \
+  --repository 'tiles/'
+
+echo "Display the size of the tiles:"
+du -h tiles


[incubator-baremaps] 03/04: Ignore example and basemap files

Posted by bc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e1e62cecc712da8174262379b8c529c840b9cb81
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Fri Aug 11 00:37:24 2023 +0200

    Ignore example and basemap files
---
 .gitignore                                         | 15 +++-
 .../baremaps/benchmarks/MBTilesBenchmark.java      |  2 +-
 .../java/org/apache/baremaps/cli/map/Export.java   |  8 +--
 .../java/org/apache/baremaps/cli/map/MBTiles.java  |  2 +-
 basemap/config.js                                  |  1 +
 basemap/tileset.js                                 |  1 +
 examples/naturalearth/tileset.json                 |  2 +-
 examples/transformation/simplifications.sql        | 46 ------------
 examples/transformation/style.json                 | 26 -------
 examples/transformation/tileset.json               | 31 ---------
 examples/transformation/workflow.json              | 81 ----------------------
 11 files changed, 21 insertions(+), 194 deletions(-)

diff --git a/.gitignore b/.gitignore
index 07613b01..3348834a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,9 +21,11 @@ examples/output/
 /baremaps/
 
 # Map
-/basemap/data/
-/basemap/cache_*/
-/basemap/local.*
+basemap/data/
+basemap/cache_*/
+basemap/local.*
+basemap/tiles.mbtiles
+basemap/tiles/
 
 # Examples
 examples/ip-to-location/archives/
@@ -36,8 +38,15 @@ examples/geocoding/downloads/
 examples/geocoding/geocoder-index/
 
 examples/extrusion/*.pbf
+
 examples/naturalearth/natural_earth_vector/
+examples/naturalearth/natural_earth_vector.gpkg.zip
+examples/naturalearth/tiles/
+
 examples/openstreetmap/*.pbf
+examples/openstreetmap/tiles.mbtiles
+examples/openstreetmap/tiles/
+
 examples/transformation/*.pbf
 
 # JMH
diff --git a/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/MBTilesBenchmark.java b/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/MBTilesBenchmark.java
index 61c81265..8d170729 100644
--- a/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/MBTilesBenchmark.java
+++ b/baremaps-benchmark/src/main/java/org/apache/baremaps/benchmarks/MBTilesBenchmark.java
@@ -47,7 +47,7 @@ public class MBTilesBenchmark {
   @Setup
   public void setup() throws IOException, TileStoreException {
     file = Files.createTempFile(Paths.get("."), "baremaps", ".mbtiles");
-    mbTilesStore = new MBTilesStore(SqliteUtils.createDataSource(file));
+    mbTilesStore = new MBTilesStore(SqliteUtils.createDataSource(file, false));
     mbTilesStore.initializeDatabase();
   }
 
diff --git a/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/Export.java b/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/Export.java
index 61df24c7..86c6e190 100644
--- a/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/Export.java
+++ b/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/Export.java
@@ -53,14 +53,14 @@ public class Export implements Callable<Integer> {
       description = "The index of the batch in the array.")
   private int batchArrayIndex = 0;
 
-  @Option(names = {"--mbtiles"}, paramLabel = "MBTILES",
-      description = "The repository is in the MBTiles format.")
-  private boolean mbtiles = false;
+  @Option(names = {"--format"}, paramLabel = "FORMAT",
+      description = "The format of the repository.")
+  private ExportVectorTiles.Format format = ExportVectorTiles.Format.file;
 
   @Override
   public Integer call() throws Exception {
     new ExportVectorTiles(tileset.toAbsolutePath(),
-        repository.toAbsolutePath(), batchArraySize, batchArrayIndex, mbtiles)
+        repository.toAbsolutePath(), batchArraySize, batchArrayIndex, format)
             .execute(new WorkflowContext());
     return 0;
   }
diff --git a/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/MBTiles.java b/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/MBTiles.java
index 04739ed9..cfb47003 100644
--- a/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/MBTiles.java
+++ b/baremaps-cli/src/main/java/org/apache/baremaps/cli/map/MBTiles.java
@@ -71,7 +71,7 @@ public class MBTiles implements Callable<Integer> {
     var configReader = new ConfigReader();
     var caffeineSpec = CaffeineSpec.parse(cache);
 
-    var datasource = SqliteUtils.createDataSource(mbtilesPath);
+    var datasource = SqliteUtils.createDataSource(mbtilesPath, true);
     var tileStoreSupplierType = new TypeLiteral<Supplier<TileStore>>() {};
     var tileStore = new MBTilesStore(datasource);
     var tileCache = new TileCache(tileStore, caffeineSpec);
diff --git a/basemap/config.js b/basemap/config.js
index b824787f..2f2cdaf1 100644
--- a/basemap/config.js
+++ b/basemap/config.js
@@ -14,5 +14,6 @@ export default {
     "database": "jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps",
     "osmPbfUrl": "https://download.geofabrik.de/europe/switzerland-latest.osm.pbf",
     "center": [6.6323, 46.5197],
+    "bounds": [6.02260949059, 45.7769477403, 10.4427014502, 47.8308275417],
     "zoom": 14,
 }
diff --git a/basemap/tileset.js b/basemap/tileset.js
index 2f8526d5..453a786c 100644
--- a/basemap/tileset.js
+++ b/basemap/tileset.js
@@ -33,6 +33,7 @@ import waterway from "./layers/waterway/tileset.js";
 export default {
   "tilejson": "2.2.0",
   "center": [...config.center, config.zoom],
+  "bounds": [...config.bounds],
   "minzoom": 0.0,
   "maxzoom": 14.0,
   "tiles": [
diff --git a/examples/naturalearth/tileset.json b/examples/naturalearth/tileset.json
index f7fc91f7..25395aa9 100644
--- a/examples/naturalearth/tileset.json
+++ b/examples/naturalearth/tileset.json
@@ -1,7 +1,7 @@
 {
   "tilejson": "2.2.0",
   "minzoom": 0,
-  "maxzoom": 12,
+  "maxzoom": 6,
   "tiles": [
     "http://localhost:9000/tiles/{z}/{x}/{y}.mvt"
   ],
diff --git a/examples/transformation/simplifications.sql b/examples/transformation/simplifications.sql
deleted file mode 100644
index 4f61ac04..00000000
--- a/examples/transformation/simplifications.sql
+++ /dev/null
@@ -1,46 +0,0 @@
--- 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.
-CREATE MATERIALIZED VIEW osm_highway_z10 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 10)) AS geom FROM osm_highway) AS osm_highway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 10)), 2));
-
-CREATE MATERIALIZED VIEW landuse_z10 AS
-    WITH
-    -- Set the size of 1 pixel at z10
-    pixel_size AS (
-        SELECT 78270 / power(2, 10) AS pixel_size
-    ),
-    -- Set the minimum area to 10 pixels at z10
-    min_area AS (
-        SELECT power(pixel_size * 10 AS min_area
-        FROM pixel_size
-    ),
-    -- Filter out polygons smaller than the minimum area
-    landuse_filtered AS (
-        SELECT id, tags, geom
-        FROM osm_landuse
-        WHERE st_area(geom) > min_area
-    ),
-    -- Buffer the landuse polygons
-    landuse_buffered AS (
-        SELECT id, tags, st_buffer(geom, buffer_distance) AS geom
-        FROM landuse_filtered, buffer_distance
-    ),
-    -- Union the buffered polygons
-    landuse_buffered_union AS (
-        SELECT st_union(geom) AS geom
-        FROM landuse_buffered
-    ),
-    -- Simplify the unioned polygon
-    landuse_simplified AS (
-        SELECT st_simplifypreservetopology(geom, 78270 / power(2, 10)) AS geom
-        FROM landuse_buffered_union
-    )
\ No newline at end of file
diff --git a/examples/transformation/style.json b/examples/transformation/style.json
deleted file mode 100644
index 094b492e..00000000
--- a/examples/transformation/style.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
-  "version" : 8,
-  "sources" : {
-    "baremaps" : {
-      "type" : "vector",
-      "url" : "http://localhost:9000/tiles.json"
-    }
-  },
-  "layers" : [ {
-    "id" : "landuse",
-    "type" : "fill",
-    "source" : "baremaps",
-    "source-layer" : "landuse",
-    "layout" : {
-      "visibility" : "visible"
-    },
-    "paint" : {
-      "fill-color" : "rgba(255, 0, 0, 1)"
-    }
-  } ],
-  "center" : [ 9.5554, 47.166 ],
-  "metadata" : {
-    "maputnik:renderer" : "mbgljs"
-  },
-  "zoom" : 14
-}
\ No newline at end of file
diff --git a/examples/transformation/tileset.json b/examples/transformation/tileset.json
deleted file mode 100644
index 6c74119b..00000000
--- a/examples/transformation/tileset.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
-  "tilejson": "2.2.0",
-  "minzoom": 0,
-  "maxzoom": 20,
-  "tiles": [
-    "http://localhost:9000/tiles/{z}/{x}/{y}.mvt"
-  ],
-  "database": "jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps",
-  "vector_layers": [
-    {
-      "id": "landuse",
-      "queries": [
-        {
-          "minzoom": 0,
-          "maxzoom": 20,
-          "sql": "SELECT 0 as id, null as tags, ST_SetSRID(geometry, 3857) as geom FROM landuse WHERE landuse = 'forest'"
-        }
-      ]
-    },
-    {
-      "id": "landuse_z10",
-      "queries": [
-        {
-          "minzoom": 0,
-          "maxzoom": 20,
-          "sql": "SELECT 0 as id, null as tags, ST_SetSRID(geometry, 3857) as geom FROM landuse_z10 WHERE landuse = 'forest'"
-        }
-      ]
-    }
-  ]
-}
\ No newline at end of file
diff --git a/examples/transformation/workflow.json b/examples/transformation/workflow.json
deleted file mode 100644
index a89c4560..00000000
--- a/examples/transformation/workflow.json
+++ /dev/null
@@ -1,81 +0,0 @@
-{
-  "steps": [
-    {
-      "id": "download",
-      "needs": [],
-      "tasks": [
-        {
-          "type": "DownloadUrl",
-          "url": "https://download.geofabrik.de/europe/switzerland-latest.osm.pbf",
-          "path": "data.osm.pbf"
-        }
-      ]
-    },
-    {
-      "id": "import",
-      "needs": [
-        "download"
-      ],
-      "tasks": [
-        {
-          "type": "CreateEntityCollection",
-          "file": "data.osm.pbf",
-          "collection": "collection",
-          "srid": 3857
-        }
-      ]
-    },
-    {
-      "id": "transform",
-      "needs": [
-        "import"
-      ],
-      "tasks": [
-        {
-          "type": "TransformEntityCollection",
-          "collection": "collection",
-          "database": "jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps",
-          "recipe": {
-            "name": "building",
-            "filter": ["has", "building"],
-            "groupBy": [],
-            "operation": "union"
-          }
-        },
-        {
-          "type": "TransformEntityCollection",
-          "collection": "collection",
-          "database": "jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps",
-          "recipe": {
-            "name": "landuse",
-            "filter": ["has", "landuse"],
-            "groupBy": ["landuse"],
-            "operation": "union"
-          }
-        },
-        {
-          "type": "TransformEntityCollection",
-          "collection": "collection",
-          "database": "jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps",
-          "recipe": {
-            "name": "natural",
-            "filter": ["has", "natural"],
-            "groupBy": ["natural"],
-            "operation": "union"
-          }
-        },
-        {
-          "type": "TransformEntityCollection",
-          "collection": "collection",
-          "database": "jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps",
-          "recipe": {
-            "name": "highway",
-            "filter": ["has", "highway"],
-            "groupBy": ["highway"],
-            "operation": "merge"
-          }
-        }
-      ]
-    }
-  ]
-}