Search in sources :

Example 1 with MbStyleSources

use of com.baremaps.model.MbStyleSources in project baremaps by baremaps.

the class Init method call.

@Override
public Integer call() throws BlobStoreException, IOException {
    BlobStore blobStore = options.blobStore();
    ObjectMapper mapper = defaultObjectMapper();
    if (style != null) {
        MbStyle styleObject = new MbStyle();
        styleObject.setName("Baremaps");
        MbStyleSources sources = new MbStyleSources();
        sources.setType("vector");
        sources.setUrl("http://localhost:9000/tiles.json");
        styleObject.setSources(Map.of("baremaps", sources));
        blobStore.put(style, Blob.builder().withByteArray(mapper.writerWithDefaultPrettyPrinter().writeValueAsBytes(styleObject)).build());
        logger.info("Style initialized: {}", style);
    }
    if (tileset != null) {
        TileJSON tilesetObject = new TileJSON();
        tilesetObject.setTilejson("2.2.0");
        tilesetObject.setName("Baremaps");
        tilesetObject.setTiles(Arrays.asList("http://localhost:9000/tiles.json"));
        blobStore.put(tileset, Blob.builder().withByteArray(mapper.writerWithDefaultPrettyPrinter().writeValueAsBytes(tilesetObject)).build());
        logger.info("Tileset initialized: {}", tileset);
    }
    return 0;
}
Also used : MbStyleSources(com.baremaps.model.MbStyleSources) TileJSON(com.baremaps.model.TileJSON) BlobStore(com.baremaps.blob.BlobStore) DefaultObjectMapper.defaultObjectMapper(com.baremaps.server.common.DefaultObjectMapper.defaultObjectMapper) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) MbStyle(com.baremaps.model.MbStyle)

Aggregations

BlobStore (com.baremaps.blob.BlobStore)1 MbStyle (com.baremaps.model.MbStyle)1 MbStyleSources (com.baremaps.model.MbStyleSources)1 TileJSON (com.baremaps.model.TileJSON)1 DefaultObjectMapper.defaultObjectMapper (com.baremaps.server.common.DefaultObjectMapper.defaultObjectMapper)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1