Customizing guide in readme (#41)

This commit is contained in:
Michael Barry
2022-10-13 04:53:30 -04:00
committed by GitHub
parent e26e13a6ff
commit ef7b26ab81
3 changed files with 112 additions and 5 deletions

View File

@@ -17,6 +17,8 @@ import com.onthegomap.planetiler.stats.Stats;
import com.onthegomap.planetiler.util.Translations;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import org.openmaptiles.addons.ExtraLayers;
import org.openmaptiles.generated.OpenMapTilesSchema;
import org.openmaptiles.generated.Tables;
import org.openmaptiles.layers.Transportation;
@@ -65,7 +67,10 @@ public class OpenMapTilesProfile extends ForwardingProfile {
List<Handler> layers = new ArrayList<>();
Transportation transportationLayer = null;
TransportationName transportationNameLayer = null;
for (Layer layer : OpenMapTilesSchema.createInstances(translations, config, stats)) {
var omtLayers = OpenMapTilesSchema.createInstances(translations, config, stats);
var extraLayers = ExtraLayers.create(translations, config, stats);
var allLayers = Stream.concat(omtLayers.stream(), extraLayers.stream()).toList();
for (Layer layer : allLayers) {
if ((onlyLayers.isEmpty() || onlyLayers.contains(layer.name())) && !excludeLayers.contains(layer.name())) {
layers.add(layer);
registerHandler(layer);

View File

@@ -0,0 +1,19 @@
package org.openmaptiles.addons;
import com.onthegomap.planetiler.config.PlanetilerConfig;
import com.onthegomap.planetiler.stats.Stats;
import com.onthegomap.planetiler.util.Translations;
import java.util.List;
import org.openmaptiles.Layer;
/**
* Registry of extra custom layers that you can add to the openmaptiles schema.
*/
public class ExtraLayers {
public static List<Layer> create(Translations translations, PlanetilerConfig config, Stats stats) {
return List.of(
// Create classes that extend Layer interface in the addons package, then instantiate them here
);
}
}