All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opentripplanner.apis.vectortiles.model.StyleSpec Maven / Gradle / Ivy

The newest version!
package org.opentripplanner.apis.vectortiles.model;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Represents a style specification for Maplibre/Mapbox vector tile layers.
 * https://maplibre.org/maplibre-style-spec/root/
 * 

* Maplibre uses these to render vector maps in the browser. */ public final class StyleSpec { private final String name; private final Collection sources; private final List layers; public StyleSpec(String name, Collection sources, List layers) { this.name = name; this.sources = sources; this.layers = layers.stream().map(StyleBuilder::toJson).toList(); } @JsonSerialize public int version() { return 8; } @JsonSerialize public String name() { return name; } @JsonSerialize public Map sources() { var output = new HashMap(); sources.forEach(s -> output.put(s.id(), s)); return output; } @JsonSerialize public List layers() { return layers; } @JsonSerialize public String glyphs() { return "https://cdn.jsdelivr.net/gh/klokantech/klokantech-gl-fonts@master/{fontstack}/{range}.pbf"; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy