forked from onthegomap/planetiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor of Mbtiles into generic TileArchive. [onthegomap#98]
* add package com.onthegomap.planetiler.writer * create new interface TileArchive * rename MbtilesMetadata to TileArchiveMetdata, make MbtilesWriter into general TileArchiveWriter
- Loading branch information
Showing
11 changed files
with
160 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
planetiler-core/src/main/java/com/onthegomap/planetiler/writer/TileArchive.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.onthegomap.planetiler.writer; | ||
|
||
import com.onthegomap.planetiler.config.PlanetilerConfig; | ||
import com.onthegomap.planetiler.util.LayerStats; | ||
|
||
/** | ||
* A TileArchive is a portable on-disk stored tileset, e.g. MBTiles | ||
*/ | ||
public interface TileArchive { | ||
|
||
/** | ||
* A high-throughput writer that accepts new tiles and queues up the writes to execute them in fewer large-batches. | ||
*/ | ||
public interface TileWriter extends AutoCloseable { | ||
void write(TileEncodingResult encodingResult); | ||
|
||
@Override | ||
void close(); | ||
|
||
default void printStats() {} | ||
} | ||
|
||
void initialize(PlanetilerConfig config, TileArchiveMetadata metadata, LayerStats layerStats); | ||
|
||
TileWriter newTileWriter(); | ||
|
||
void finalize(PlanetilerConfig config); | ||
} |
35 changes: 35 additions & 0 deletions
35
planetiler-core/src/main/java/com/onthegomap/planetiler/writer/TileArchiveMetadata.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.onthegomap.planetiler.writer; | ||
|
||
import com.onthegomap.planetiler.Profile; | ||
import com.onthegomap.planetiler.config.Arguments; | ||
|
||
/** Controls information that tile writers will write to the archive */ | ||
public record TileArchiveMetadata( | ||
String name, | ||
String description, | ||
String attribution, | ||
String version, | ||
String type | ||
) { | ||
|
||
public TileArchiveMetadata(Profile profile) { | ||
this( | ||
profile.name(), | ||
profile.description(), | ||
profile.attribution(), | ||
profile.version(), | ||
profile.isOverlay() ? "overlay" : "baselayer" | ||
); | ||
} | ||
|
||
public TileArchiveMetadata(Profile profile, Arguments args) { | ||
this( | ||
args.getString("tileset_name", "'name' attribute for tileset metadata", profile.name()), | ||
args.getString("tileset_description", "'description' attribute for tileset metadata", profile.description()), | ||
args.getString("tileset_attribution", "'attribution' attribute for tileset metadata", profile.attribution()), | ||
args.getString("tileset_version", "'version' attribute for tileset metadata", profile.version()), | ||
args.getString("tileset_type", "'type' attribute for tileset metadata", | ||
profile.isOverlay() ? "overlay" : "baselayer") | ||
); | ||
} | ||
} |
Oops, something went wrong.