mountain peak tests

pull/1/head
Mike Barry 2021-06-14 07:04:03 -04:00
rodzic 9915f4e134
commit 3ee817c48a
31 zmienionych plików z 2238 dodań i 540 usunięć

Wyświetl plik

@ -119,5 +119,21 @@
<filtering>true</filtering>
</testResource>
</testResources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

Wyświetl plik

@ -306,8 +306,9 @@ public class FeatureCollector implements Iterable<FeatureCollector.Feature> {
public Feature setAttr(String key, Object value) {
if (value instanceof ZoomFunction) {
attrsChangeByZoom = true;
} else if (value != null) {
attrs.put(key, value);
}
attrs.put(key, value);
return this;
}

Wyświetl plik

@ -4,6 +4,7 @@ import com.carrotsearch.hppc.ObjectIntMap;
import com.graphhopper.coll.GHObjectIntHashMap;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
public class Parse {
@ -23,6 +24,20 @@ public class Parse {
}
}
private static final Pattern INT_SUBSTRING_PATTERN = Pattern.compile("^(-?\\d+)(\\D|$)");
public static Integer parseIntSubstring(String tag) {
if (tag == null) {
return null;
}
try {
var matcher = INT_SUBSTRING_PATTERN.matcher(tag);
return matcher.find() ? Integer.parseInt(matcher.group(1)) : null;
} catch (NumberFormatException e) {
return null;
}
}
private static final Set<String> booleanFalseValues = Set.of("", "0", "false", "no");
public static boolean bool(Object tag) {

Wyświetl plik

@ -50,6 +50,21 @@ public class ParseTest {
assertEquals(out, Parse.direction(in));
}
@ParameterizedTest
@CsvSource(value = {
"1, 1",
"0, 0",
"-1, -1",
"1.1, 1",
"-1.1, -1",
"-1.23 m, -1",
"one meter, null",
"null, null"
}, nullValues = {"null"})
public void testIntSubstring(String in, Integer out) {
assertEquals(out, Parse.parseIntSubstring(in));
}
@TestFactory
public Stream<DynamicTest> testWayzorder() {
return Stream.<Map.Entry<Map<String, Object>, Integer>>of(

Wyświetl plik

@ -23,6 +23,13 @@
<artifactId>snakeyaml</artifactId>
<version>1.29</version>
</dependency>
<dependency>
<groupId>com.onthegomap</groupId>
<artifactId>flatmap-core</artifactId>
<version>${project.parent.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>

Wyświetl plik

@ -25,6 +25,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Stream;
import org.apache.commons.text.StringEscapeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.LoaderOptions;
@ -43,6 +44,8 @@ public class Generate {
List<String> layers,
String version,
String attribution,
String name,
String description,
List<String> languages
) {}
@ -77,13 +80,13 @@ public class Generate {
JsonNode require
) {}
private static record Imposm3Table(
static record Imposm3Table(
String type,
@JsonProperty("_resolve_wikidata") boolean resolveWikidata,
List<Imposm3Column> columns,
Imposm3Filters filters,
JsonNode mapping,
Map<String, Map<String, List<String>>> type_mappings
Map<String, JsonNode> type_mappings
) {}
@JsonIgnoreProperties(ignoreUnknown = true)
@ -155,7 +158,7 @@ public class Generate {
FileUtils.deleteDirectory(output);
Files.createDirectories(output);
emitLayerDefinitions(layers, packageName, output);
emitLayerDefinitions(config.tileset, layers, packageName, output);
emitTableDefinitions(tables, packageName, output);
// layers.forEach((layer) -> LOGGER.info("layer: " + layer.layer.id));
@ -170,12 +173,24 @@ public class Generate {
package %s;
import static com.onthegomap.flatmap.openmaptiles.Expression.*;
import com.onthegomap.flatmap.openmaptiles.Expression;
import com.onthegomap.flatmap.openmaptiles.MultiExpression;
import com.onthegomap.flatmap.FeatureCollector;
import com.onthegomap.flatmap.SourceFeature;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Tables {
public interface Table {}
public interface Row {}
public interface Constructor {
Row create(SourceFeature source, String mappingKey);
}
public interface RowHandler<T extends Row> {
void process(T element, FeatureCollector features);
}
""".formatted(packageName));
List<String> classNames = new ArrayList<>();
@ -183,7 +198,7 @@ public class Generate {
String key = entry.getKey();
Imposm3Table table = entry.getValue();
List<OsmTableField> fields = getFields(table);
Expression mappingExpression = parseImposm3MappingExpression(table.mapping, table.filters);
Expression mappingExpression = parseImposm3MappingExpression(table);
String mapping = "public static final Expression MAPPING = %s;".formatted(
mappingExpression
);
@ -191,22 +206,29 @@ public class Generate {
classNames.add(className);
if (fields.size() <= 1) {
tablesClass.append("""
public static record %s(%s) implements Table {
public static record %s(%s) implements Row {
%s
public interface Handler {
void process(%s element, FeatureCollector features);
}
}
""".formatted(
className,
fields.stream().map(c -> c.clazz + " " + lowerUnderscoreToLowerCamel(c.name))
.collect(joining(", ")),
mapping
mapping,
className
).indent(2));
} else {
tablesClass.append("""
public static record %s(%s) implements Table {
public %s(com.onthegomap.flatmap.SourceFeature source) {
public static record %s(%s) implements Row {
public %s(SourceFeature source, String mappingKey) {
this(%s);
}
%s
public interface Handler {
void process(%s element, FeatureCollector features);
}
}
""".formatted(
className,
@ -214,34 +236,62 @@ public class Generate {
.collect(joining(", ")),
className,
fields.stream().map(c -> c.extractCode).collect(joining(", ")),
mapping
mapping,
className
).indent(2));
}
}
tablesClass.append("""
public static final MultiExpression<java.util.function.Function<com.onthegomap.flatmap.SourceFeature, Table>> MAPPINGS = MultiExpression.of(Map.ofEntries(
public static final MultiExpression<Constructor> MAPPINGS = MultiExpression.of(Map.ofEntries(
%s
));
""".formatted(
classNames.stream().map(className -> "Map.entry(%s::new, %s.MAPPING)".formatted(className, className))
.collect(joining(",\n")).indent(2).strip()
).indent(2));
tablesClass.append("}");
String handlerCondition = classNames.stream().map(className ->
"""
if (handler instanceof %s.Handler typedHandler) {
result.computeIfAbsent(%s.class, cls -> new ArrayList<>()).add((RowHandler<%s>) typedHandler::process);
}""".formatted(className, className, className)
).collect(joining(" else "));
tablesClass.append("""
public static Map<Class<? extends Row>, List<RowHandler<? extends Row>>> generateDispatchMap(List<?> handlers) {
Map<Class<? extends Row>, List<RowHandler<? extends Row>>> result = new HashMap<>();
for (var handler : handlers) {
%s
}
return result;
}
}
""".formatted(handlerCondition.indent(6).trim()));
Files.writeString(output.resolve("Tables.java"), tablesClass);
}
static Expression parseImposm3MappingExpression(JsonNode mapping, Imposm3Filters filters) {
static Expression parseImposm3MappingExpression(Imposm3Table table) {
if (table.type_mappings != null) {
return or(
table.type_mappings.entrySet().stream().map(entry ->
parseImposm3MappingExpression(entry.getKey(), entry.getValue(), table.filters)
).toList()
).simplify();
} else {
return parseImposm3MappingExpression(table.type, table.mapping, table.filters);
}
}
static Expression parseImposm3MappingExpression(String type, JsonNode mapping, Imposm3Filters filters) {
return and(
or(parseExpression(mapping).toList()),
and(filters == null || filters.require == null ? List.of() : parseExpression(filters.require).toList()),
not(or(filters == null || filters.reject == null ? List.of() : parseExpression(filters.reject).toList()))
not(or(filters == null || filters.reject == null ? List.of() : parseExpression(filters.reject).toList())),
"geometry".equals(type) ? and() : matchAny("__" + type, "true")
).simplify();
}
private static List<OsmTableField> getFields(Imposm3Table tableDefinition) {
List<OsmTableField> result = new ArrayList<>();
result.add(new OsmTableField("com.onthegomap.flatmap.SourceFeature", "source", "source"));
// TODO columns used, and from_member
for (Imposm3Column col : tableDefinition.columns) {
switch (col.type) {
@ -251,12 +301,10 @@ public class Generate {
case "member_id", "member_role", "member_type", "member_index" -> {
// TODO
}
case "mapping_key" -> {
// TODO?
}
case "mapping_value" -> {
// TODO??
}
case "mapping_key" -> result
.add(new OsmTableField("String", col.name, "mappingKey"));
case "mapping_value" -> result
.add(new OsmTableField("String", col.name, "source.getString(mappingKey)"));
case "string" -> result
.add(new OsmTableField("String", col.name,
"source.getString(\"%s\")".formatted(Objects.requireNonNull(col.key, col.toString()))));
@ -272,6 +320,7 @@ public class Generate {
default -> throw new IllegalArgumentException("Unhandled column: " + col.type);
}
}
result.add(new OsmTableField("com.onthegomap.flatmap.SourceFeature", "source", "source"));
return result;
}
@ -281,7 +330,8 @@ public class Generate {
String extractCode
) {}
private static void emitLayerDefinitions(List<LayerConfig> layers, String packageName, Path output)
private static void emitLayerDefinitions(OpenmaptilesTileSet info, List<LayerConfig> layers, String packageName,
Path output)
throws IOException {
StringBuilder layersClass = new StringBuilder();
layersClass.append("""
@ -290,11 +340,35 @@ public class Generate {
import static com.onthegomap.flatmap.openmaptiles.Expression.*;
import com.onthegomap.flatmap.openmaptiles.MultiExpression;
import com.onthegomap.flatmap.openmaptiles.Layer;
import java.util.List;
import java.util.Map;
public class Layers {
""".formatted(packageName));
public static final String NAME = %s;
public static final String DESCRIPTION = %s;
public static final String VERSION = %s;
public static final String ATTRIBUTION = %s;
public static List<Layer> createInstances() {
return List.of(
%s
);
}
"""
.formatted(
packageName,
quote(info.name),
quote(info.description),
quote(info.version),
quote(info.attribution),
layers.stream()
.map(
l -> "new com.onthegomap.flatmap.openmaptiles.layers.%s()"
.formatted(lowerUnderscoreToUpperCamel(l.layer.id)))
.collect(joining(",\n"))
.indent(6).trim()
));
for (var layer : layers) {
String layerName = layer.layer.id;
String className = lowerUnderscoreToUpperCamel(layerName);
@ -356,16 +430,20 @@ public class Generate {
layersClass.append("""
/** %s */
public static class %s {
public static final double BUFFER_SIZE = %s;
public static final String NAME = %s;
public static final class Fields {
public interface %s extends Layer {
double BUFFER_SIZE = %s;
String LAYER_NAME = %s;
@Override
default String name() {
return LAYER_NAME;
}
final class Fields {
%s
}
public static final class FieldValues {
final class FieldValues {
%s
}
public static final class FieldMappings {
final class FieldMappings {
%s
}
}
@ -466,9 +544,6 @@ public class Generate {
if (other == null) {
return "null";
}
if (other.contains("\"")) {
throw new IllegalStateException("cannot quote: " + other);
}
return '"' + other + '"';
return '"' + StringEscapeUtils.escapeJava(other) + '"';
}
}

Wyświetl plik

@ -0,0 +1,9 @@
package com.onthegomap.flatmap.openmaptiles;
public interface Layer {
default void release() {
}
String name();
}

Wyświetl plik

@ -99,6 +99,7 @@ public record MultiExpression<T>(Map<T, Expression> expressions) {
for (int i = 0; i < children.size(); i++) {
Expression child = children.get(i);
if (!evaluate(child, input, matchKeys)) {
matchKeys.clear();
return false;
}
}

Wyświetl plik

@ -8,8 +8,12 @@ import com.onthegomap.flatmap.SourceFeature;
import com.onthegomap.flatmap.Translations;
import com.onthegomap.flatmap.VectorTileEncoder;
import com.onthegomap.flatmap.geo.GeometryException;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
import com.onthegomap.flatmap.openmaptiles.generated.Tables;
import com.onthegomap.flatmap.read.OpenStreetMapReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -22,13 +26,25 @@ public class OpenMapTilesProfile implements Profile {
public static final String NATURAL_EARTH_SOURCE = "natural_earth";
public static final String OSM_SOURCE = "osm";
private static final Logger LOGGER = LoggerFactory.getLogger(OpenMapTilesProfile.class);
private final MultiExpression.MultiExpressionIndex<Tables.Constructor> osmMappings;
private final List<Layer> layers;
private final Map<Class<? extends Tables.Row>, List<Tables.RowHandler<Tables.Row>>> osmDispatchMap;
public OpenMapTilesProfile(Translations translations) {
this.osmMappings = Tables.MAPPINGS.index();
this.layers = Layers.createInstances();
osmDispatchMap = new HashMap<>();
Tables.generateDispatchMap(layers).forEach((clazz, handlers) -> {
osmDispatchMap.put(clazz, handlers.stream().map(handler -> {
@SuppressWarnings("unchecked") Tables.RowHandler<Tables.Row> rawHandler = (Tables.RowHandler<Tables.Row>) handler;
return rawHandler;
}).toList());
});
}
@Override
public void release() {
layers.forEach(Layer::release);
}
@Override
@ -40,28 +56,6 @@ public class OpenMapTilesProfile implements Profile {
return items;
}
@Override
public String name() {
return "OpenMapTiles";
}
@Override
public String description() {
return "A tileset showcasing all layers in OpenMapTiles. https://openmaptiles.org";
}
@Override
public String attribution() {
return """
<a href="https://www.openmaptiles.org/" target="_blank">&copy; OpenMapTiles</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>
""".trim();
}
@Override
public String version() {
return "3.12.1";
}
@Override
public List<OpenStreetMapReader.RelationInfo> preprocessOsmRelation(ReaderRelation relation) {
return null;
@ -69,40 +63,89 @@ public class OpenMapTilesProfile implements Profile {
@Override
public void processFeature(SourceFeature sourceFeature, FeatureCollector features) {
if (sourceFeature.isPoint()) {
if (sourceFeature.hasTag("natural", "peak", "volcano")) {
features.point("mountain_peak")
.setAttr("name", sourceFeature.getTag("name"))
.setLabelGridSizeAndLimit(13, 100, 5);
}
}
if (WATER_POLYGON_SOURCE.equals(sourceFeature.getSource())) {
features.polygon("water").setZoomRange(6, 14).setAttr("class", "ocean");
} else if (NATURAL_EARTH_SOURCE.equals(sourceFeature.getSource())) {
String sourceLayer = sourceFeature.getSourceLayer();
boolean lake = sourceLayer.endsWith("_lakes");
switch (sourceLayer) {
case "ne_10m_lakes", "ne_10m_ocean" -> features.polygon("water")
.setZoomRange(4, 5)
.setAttr("class", lake ? "lake" : "ocean");
case "ne_50m_lakes", "ne_50m_ocean" -> features.polygon("water")
.setZoomRange(2, 3)
.setAttr("class", lake ? "lake" : "ocean");
case "ne_110m_lakes", "ne_110m_ocean" -> features.polygon("water")
.setZoomRange(0, 1)
.setAttr("class", lake ? "lake" : "ocean");
}
}
if (OSM_SOURCE.equals(sourceFeature.getSource())) {
if (sourceFeature.canBeLine()) {
sourceFeature.properties().put("__linestring", "true");
}
if (sourceFeature.canBePolygon()) {
if (sourceFeature.hasTag("building")) {
features.polygon("building")
.setZoomRange(13, 14)
.setMinPixelSize(MERGE_Z13_BUILDINGS ? 0 : 4);
sourceFeature.properties().put("__polygon", "true");
}
if (sourceFeature.isPoint()) {
sourceFeature.properties().put("__point", "true");
}
for (var match : osmMappings.getMatchesWithTriggers(sourceFeature.properties())) {
var row = match.match().create(sourceFeature, match.keys().get(0));
var handlers = osmDispatchMap.get(row.getClass());
for (Tables.RowHandler<Tables.Row> handler : handlers) {
handler.process(row, features);
}
}
}
//
// if (sourceFeature.isPoint()) {
// if (sourceFeature.hasTag("natural", "peak", "volcano")) {
// features.point("mountain_peak")
// .setAttr("name", sourceFeature.getTag("name"))
// .setLabelGridSizeAndLimit(13, 100, 5);
// }
// }
//
// if (WATER_POLYGON_SOURCE.equals(sourceFeature.getSource())) {
// features.polygon("water").setZoomRange(6, 14).setAttr("class", "ocean");
// } else if (NATURAL_EARTH_SOURCE.equals(sourceFeature.getSource())) {
// String sourceLayer = sourceFeature.getSourceLayer();
// boolean lake = sourceLayer.endsWith("_lakes");
// switch (sourceLayer) {
// case "ne_10m_lakes", "ne_10m_ocean" -> features.polygon("water")
// .setZoomRange(4, 5)
// .setAttr("class", lake ? "lake" : "ocean");
// case "ne_50m_lakes", "ne_50m_ocean" -> features.polygon("water")
// .setZoomRange(2, 3)
// .setAttr("class", lake ? "lake" : "ocean");
// case "ne_110m_lakes", "ne_110m_ocean" -> features.polygon("water")
// .setZoomRange(0, 1)
// .setAttr("class", lake ? "lake" : "ocean");
// }
// }
//
// if (OSM_SOURCE.equals(sourceFeature.getSource())) {
// if (sourceFeature.canBePolygon()) {
// if (sourceFeature.hasTag("building")) {
// features.polygon("building")
// .setZoomRange(13, 14)
// .setMinPixelSize(MERGE_Z13_BUILDINGS ? 0 : 4);
// }
// }
// }
}
public interface SourceFeatureProcessors {
void process(SourceFeature feature, FeatureCollector features);
}
public interface FeaturePostProcessor {
void postProcess(int zoom, List<VectorTileEncoder.Feature> items);
}
@Override
public String name() {
return Layers.NAME;
}
@Override
public String description() {
return Layers.DESCRIPTION;
}
@Override
public String attribution() {
return Layers.ATTRIBUTION;
}
@Override
public String version() {
return Layers.VERSION;
}
}

Wyświetl plik

@ -0,0 +1,24 @@
package com.onthegomap.flatmap.openmaptiles;
public class Utils {
public static <T> T coalesce(T a, T b) {
return a != null ? a : b;
}
public static <T> T coalesce(T a, T b, T c) {
return a != null ? a : b != null ? b : c;
}
public static <T> T coalesce(T a, T b, T c, T d) {
return a != null ? a : b != null ? b : c != null ? d : d;
}
public static <T> T nullIf(T a, T nullValue) {
return nullValue.equals(a) ? null : a;
}
public static Integer metersToFeet(Integer meters) {
return meters != null ? (int) (meters * 3.2808399) : null;
}
}

Wyświetl plik

@ -2,184 +2,706 @@
package com.onthegomap.flatmap.openmaptiles.generated;
import static com.onthegomap.flatmap.openmaptiles.Expression.*;
import com.onthegomap.flatmap.FeatureCollector;
import com.onthegomap.flatmap.SourceFeature;
import com.onthegomap.flatmap.openmaptiles.Expression;
import com.onthegomap.flatmap.openmaptiles.MultiExpression;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Tables {
public interface Table {}
public static record OsmWaterPolygon(com.onthegomap.flatmap.SourceFeature source, String name, String nameEn, String nameDe, String natural, String landuse, String waterway, boolean isIntermittent, boolean isTunnel, boolean isBridge) implements Table {
public OsmWaterPolygon(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("natural"), source.getString("landuse"), source.getString("waterway"), source.getBoolean("intermittent"), source.getBoolean("tunnel"), source.getBoolean("bridge"));
public interface Row {}
public interface Constructor {
Row create(SourceFeature source, String mappingKey);
}
public interface RowHandler<T extends Row> {
void process(T element, FeatureCollector features);
}
public static record OsmWaterPolygon(
String name, String nameEn, String nameDe, String natural, String landuse, String waterway, boolean isIntermittent,
boolean isTunnel, boolean isBridge, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmWaterPolygon(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"),
source.getString("natural"), source.getString("landuse"), source.getString("waterway"),
source.getBoolean("intermittent"), source.getBoolean("tunnel"), source.getBoolean("bridge"), source);
}
public static final Expression MAPPING = and(or(matchAny("landuse", "reservoir", "basin", "salt_pond"), matchAny("leisure", "swimming_pool"), matchAny("natural", "water", "bay"), matchAny("waterway", "river", "riverbank", "stream", "canal", "drain", "ditch", "dock")), not(matchAny("covered", "yes")));
}
public static record OsmWaterwayLinestring(com.onthegomap.flatmap.SourceFeature source, String waterway, String name, String nameEn, String nameDe, boolean isTunnel, boolean isBridge, boolean isIntermittent) implements Table {
public OsmWaterwayLinestring(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("waterway"), source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getBoolean("tunnel"), source.getBoolean("bridge"), source.getBoolean("intermittent"));
public static final Expression MAPPING = and(
or(matchAny("landuse", "reservoir", "basin", "salt_pond"), matchAny("leisure", "swimming_pool"),
matchAny("natural", "water", "bay"),
matchAny("waterway", "river", "riverbank", "stream", "canal", "drain", "ditch", "dock")),
not(matchAny("covered", "yes")), matchAny("__polygon", "true"));
public interface Handler {
void process(OsmWaterPolygon element, FeatureCollector features);
}
public static final Expression MAPPING = matchAny("waterway", "stream", "river", "canal", "drain", "ditch");
}
public static record OsmLandcoverPolygon(com.onthegomap.flatmap.SourceFeature source) implements Table {
public static final Expression MAPPING = or(matchAny("landuse", "allotments", "farm", "farmland", "orchard", "plant_nursery", "vineyard", "grass", "grassland", "meadow", "forest", "village_green", "recreation_ground", "park"), matchAny("natural", "wood", "wetland", "fell", "grassland", "heath", "scrub", "tundra", "glacier", "bare_rock", "scree", "beach", "sand", "dune"), matchAny("leisure", "park", "garden", "golf_course"), matchAny("wetland", "bog", "swamp", "wet_meadow", "marsh", "reedbed", "saltern", "tidalflat", "saltmarsh", "mangrove"));
}
public static record OsmLandusePolygon(com.onthegomap.flatmap.SourceFeature source, String landuse, String amenity, String leisure, String tourism, String place, String waterway) implements Table {
public OsmLandusePolygon(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("landuse"), source.getString("amenity"), source.getString("leisure"), source.getString("tourism"), source.getString("place"), source.getString("waterway"));
public static record OsmWaterwayLinestring(
String waterway, String name, String nameEn, String nameDe, boolean isTunnel, boolean isBridge,
boolean isIntermittent, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmWaterwayLinestring(SourceFeature source, String mappingKey) {
this(source.getString("waterway"), source.getString("name"), source.getString("name:en"),
source.getString("name:de"), source.getBoolean("tunnel"), source.getBoolean("bridge"),
source.getBoolean("intermittent"), source);
}
public static final Expression MAPPING = or(matchAny("landuse", "railway", "cemetery", "military", "residential", "commercial", "industrial", "garages", "retail"), matchAny("amenity", "bus_station", "school", "university", "kindergarten", "college", "library", "hospital"), matchAny("leisure", "stadium", "pitch", "playground", "track"), matchAny("tourism", "theme_park", "zoo"), matchAny("place", "suburb", "quarter", "neighbourhood"), matchAny("waterway", "dam"));
}
public static record OsmPeakPoint(com.onthegomap.flatmap.SourceFeature source, String name, String nameEn, String nameDe, String ele, String wikipedia) implements Table {
public OsmPeakPoint(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("ele"), source.getString("wikipedia"));
public static final Expression MAPPING = and(matchAny("waterway", "stream", "river", "canal", "drain", "ditch"),
matchAny("__linestring", "true"));
public interface Handler {
void process(OsmWaterwayLinestring element, FeatureCollector features);
}
public static final Expression MAPPING = matchAny("natural", "peak", "volcano");
}
public static record OsmParkPolygon(com.onthegomap.flatmap.SourceFeature source, String name, String nameEn, String nameDe, String landuse, String leisure, String boundary, String protectionTitle) implements Table {
public OsmParkPolygon(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("landuse"), source.getString("leisure"), source.getString("boundary"), source.getString("protection_title"));
public static record OsmLandcoverPolygon(
String subclass, String mappingKey, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmLandcoverPolygon(SourceFeature source, String mappingKey) {
this(source.getString(mappingKey), mappingKey, source);
}
public static final Expression MAPPING = or(matchAny("leisure", "nature_reserve"), matchAny("boundary", "national_park", "protected_area"));
}
public static record OsmBorderDispRelation(com.onthegomap.flatmap.SourceFeature source, String name, String boundary, long adminLevel, String claimedBy, String disputedBy, boolean maritime) implements Table {
public OsmBorderDispRelation(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("boundary"), source.getLong("admin_level"), source.getString("claimed_by"), source.getString("disputed_by"), source.getBoolean("maritime"));
public static final Expression MAPPING = and(or(
matchAny("landuse", "allotments", "farm", "farmland", "orchard", "plant_nursery", "vineyard", "grass",
"grassland", "meadow", "forest", "village_green", "recreation_ground", "park"),
matchAny("natural", "wood", "wetland", "fell", "grassland", "heath", "scrub", "tundra", "glacier", "bare_rock",
"scree", "beach", "sand", "dune"), matchAny("leisure", "park", "garden", "golf_course"),
matchAny("wetland", "bog", "swamp", "wet_meadow", "marsh", "reedbed", "saltern", "tidalflat", "saltmarsh",
"mangrove")), matchAny("__polygon", "true"));
public interface Handler {
void process(OsmLandcoverPolygon element, FeatureCollector features);
}
public static final Expression MAPPING = and(matchAny("type", "boundary"), matchField("admin_level"), matchField("claimed_by"));
}
public static record OsmAerowayPolygon(com.onthegomap.flatmap.SourceFeature source, String ref) implements Table {
public OsmAerowayPolygon(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("ref"));
public static record OsmLandusePolygon(
String landuse, String amenity, String leisure, String tourism, String place, String waterway,
com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmLandusePolygon(SourceFeature source, String mappingKey) {
this(source.getString("landuse"), source.getString("amenity"), source.getString("leisure"),
source.getString("tourism"), source.getString("place"), source.getString("waterway"), source);
}
public static final Expression MAPPING = or(matchAny("aeroway", "aerodrome", "heliport", "runway", "helipad", "taxiway", "apron"), matchAny("area:aeroway", "aerodrome", "heliport", "runway", "helipad", "taxiway", "apron"));
}
public static record OsmAerowayLinestring(com.onthegomap.flatmap.SourceFeature source, String ref, String aeroway) implements Table {
public OsmAerowayLinestring(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("ref"), source.getString("aeroway"));
public static final Expression MAPPING = and(or(
matchAny("landuse", "railway", "cemetery", "military", "residential", "commercial", "industrial", "garages",
"retail"),
matchAny("amenity", "bus_station", "school", "university", "kindergarten", "college", "library", "hospital"),
matchAny("leisure", "stadium", "pitch", "playground", "track"), matchAny("tourism", "theme_park", "zoo"),
matchAny("place", "suburb", "quarter", "neighbourhood"), matchAny("waterway", "dam")),
matchAny("__polygon", "true"));
public interface Handler {
void process(OsmLandusePolygon element, FeatureCollector features);
}
public static final Expression MAPPING = matchAny("aeroway", "runway", "taxiway");
}
public static record OsmAerowayPoint(com.onthegomap.flatmap.SourceFeature source, String ref, String aeroway) implements Table {
public OsmAerowayPoint(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("ref"), source.getString("aeroway"));
public static record OsmPeakPoint(
String name, String nameEn, String nameDe, String ele, String wikipedia, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmPeakPoint(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("ele"),
source.getString("wikipedia"), source);
}
public static final Expression MAPPING = matchAny("aeroway", "gate");
}
public static record OsmHighwayLinestring(com.onthegomap.flatmap.SourceFeature source, String highway, String construction, String ref, String network, int zOrder, long layer, long level, boolean indoor, String name, String nameEn, String nameDe, String shortName, boolean isTunnel, boolean isBridge, boolean isRamp, boolean isFord, int isOneway, boolean isArea, String service, String usage, String publicTransport, String manMade, String bicycle, String foot, String horse, String mtbScale, String surface) implements Table {
public OsmHighwayLinestring(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("highway"), source.getString("construction"), source.getString("ref"), source.getString("network"), source.getWayZorder(), source.getLong("layer"), source.getLong("level"), source.getBoolean("indoor"), source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("short_name"), source.getBoolean("tunnel"), source.getBoolean("bridge"), source.getBoolean("ramp"), source.getBoolean("ford"), source.getDirection("oneway"), source.getBoolean("area"), source.getString("service"), source.getString("usage"), source.getString("public_transport"), source.getString("man_made"), source.getString("bicycle"), source.getString("foot"), source.getString("horse"), source.getString("mtb:scale"), source.getString("surface"));
public static final Expression MAPPING = and(matchAny("natural", "peak", "volcano"), matchAny("__point", "true"));
public interface Handler {
void process(OsmPeakPoint element, FeatureCollector features);
}
public static final Expression MAPPING = or(matchAny("highway", "motorway", "motorway_link", "trunk", "trunk_link", "primary", "primary_link", "secondary", "secondary_link", "tertiary", "tertiary_link", "unclassified", "residential", "living_street", "road", "pedestrian", "path", "footway", "cycleway", "steps", "bridleway", "corridor", "service", "track", "raceway", "construction"), matchAny("public_transport", "platform"), matchAny("man_made", "pier"));
}
public static record OsmRailwayLinestring(com.onthegomap.flatmap.SourceFeature source, String railway, String ref, String network, int zOrder, long layer, long level, boolean indoor, String name, String nameEn, String nameDe, String shortName, boolean isTunnel, boolean isBridge, boolean isRamp, boolean isFord, int isOneway, boolean isArea, String service, String usage) implements Table {
public OsmRailwayLinestring(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("railway"), source.getString("ref"), source.getString("network"), source.getWayZorder(), source.getLong("layer"), source.getLong("level"), source.getBoolean("indoor"), source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("short_name"), source.getBoolean("tunnel"), source.getBoolean("bridge"), source.getBoolean("ramp"), source.getBoolean("ford"), source.getDirection("oneway"), source.getBoolean("area"), source.getString("service"), source.getString("usage"));
public static record OsmParkPolygon(
String name, String nameEn, String nameDe, String landuse, String leisure, String boundary, String protectionTitle,
com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmParkPolygon(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"),
source.getString("landuse"), source.getString("leisure"), source.getString("boundary"),
source.getString("protection_title"), source);
}
public static final Expression MAPPING = matchAny("railway", "rail", "narrow_gauge", "preserved", "funicular", "subway", "light_rail", "monorail", "tram");
}
public static record OsmAerialwayLinestring(com.onthegomap.flatmap.SourceFeature source, String aerialway, int zOrder, long layer, String name, String nameEn, String nameDe, String shortName, boolean isTunnel, boolean isBridge, boolean isRamp, boolean isFord, int isOneway, boolean isArea, String service, String usage) implements Table {
public OsmAerialwayLinestring(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("aerialway"), source.getWayZorder(), source.getLong("layer"), source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("short_name"), source.getBoolean("tunnel"), source.getBoolean("bridge"), source.getBoolean("ramp"), source.getBoolean("ford"), source.getDirection("oneway"), source.getBoolean("area"), source.getString("service"), source.getString("usage"));
public static final Expression MAPPING = and(
or(matchAny("leisure", "nature_reserve"), matchAny("boundary", "national_park", "protected_area")),
matchAny("__polygon", "true"));
public interface Handler {
void process(OsmParkPolygon element, FeatureCollector features);
}
public static final Expression MAPPING = matchAny("aerialway", "cable_car", "gondola");
}
public static record OsmShipwayLinestring(com.onthegomap.flatmap.SourceFeature source, String shipway, int zOrder, long layer, String name, String nameEn, String nameDe, String shortName, boolean isTunnel, boolean isBridge, boolean isRamp, boolean isFord, int isOneway, boolean isArea, String service, String usage) implements Table {
public OsmShipwayLinestring(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("route"), source.getWayZorder(), source.getLong("layer"), source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("short_name"), source.getBoolean("tunnel"), source.getBoolean("bridge"), source.getBoolean("ramp"), source.getBoolean("ford"), source.getDirection("oneway"), source.getBoolean("area"), source.getString("service"), source.getString("usage"));
public static record OsmBorderDispRelation(
String name, String boundary, long adminLevel, String claimedBy, String disputedBy, boolean maritime,
com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmBorderDispRelation(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("boundary"), source.getLong("admin_level"),
source.getString("claimed_by"), source.getString("disputed_by"), source.getBoolean("maritime"), source);
}
public static final Expression MAPPING = matchAny("route", "ferry");
}
public static record OsmHighwayPolygon(com.onthegomap.flatmap.SourceFeature source, String highway, int zOrder, long layer, long level, boolean indoor, boolean isArea, String publicTransport, String manMade) implements Table {
public OsmHighwayPolygon(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("highway"), source.getWayZorder(), source.getLong("layer"), source.getLong("level"), source.getBoolean("indoor"), source.getBoolean("area"), source.getString("public_transport"), source.getString("man_made"));
public static final Expression MAPPING = and(matchAny("type", "boundary"), matchField("admin_level"),
matchField("claimed_by"), matchAny("__relation_member", "true"));
public interface Handler {
void process(OsmBorderDispRelation element, FeatureCollector features);
}
public static final Expression MAPPING = or(matchAny("highway", "path", "cycleway", "bridleway", "footway", "corridor", "pedestrian", "steps"), matchAny("public_transport", "platform"), matchAny("man_made", "bridge", "pier"));
}
public static record OsmRouteMember(com.onthegomap.flatmap.SourceFeature source, String ref, String network, String name) implements Table {
public OsmRouteMember(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("ref"), source.getString("network"), source.getString("name"));
public static record OsmAerowayPolygon(
String ref, String aeroway, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmAerowayPolygon(SourceFeature source, String mappingKey) {
this(source.getString("ref"), source.getString(mappingKey), source);
}
public static final Expression MAPPING = matchAny("route", "road");
}
public static record OsmBuildingPolygon(com.onthegomap.flatmap.SourceFeature source, String material, String colour, String building, String buildingpart, String buildingheight, String buildingminHeight, String buildinglevels, String buildingminLevel, String height, String minHeight, String levels, String minLevel) implements Table {
public OsmBuildingPolygon(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("building:material"), source.getString("building:colour"), source.getString("building"), source.getString("building:part"), source.getString("building:height"), source.getString("building:min_height"), source.getString("building:levels"), source.getString("building:min_level"), source.getString("height"), source.getString("min_height"), source.getString("levels"), source.getString("min_level"));
public static final Expression MAPPING = and(
or(matchAny("aeroway", "aerodrome", "heliport", "runway", "helipad", "taxiway", "apron"),
matchAny("area:aeroway", "aerodrome", "heliport", "runway", "helipad", "taxiway", "apron")),
matchAny("__polygon", "true"));
public interface Handler {
void process(OsmAerowayPolygon element, FeatureCollector features);
}
public static final Expression MAPPING = and(or(matchField("building:part"), matchField("building"), matchAny("aeroway", "terminal", "hangar")), not(matchAny("building", "no", "none", "No")), not(matchAny("building:part", "no", "none", "No")), not(matchAny("man_made", "bridge")));
}
public static record OsmBuildingRelation(com.onthegomap.flatmap.SourceFeature source, String building, String material, String colour, String buildingpart, String buildingheight, String height, String buildingminHeight, String minHeight, String buildinglevels, String levels, String buildingminLevel, String minLevel, String relbuildingheight, String relheight, String relbuildingminHeight, String relminHeight, String relbuildinglevels, String rellevels, String relbuildingminLevel, String relminLevel) implements Table {
public OsmBuildingRelation(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("building"), source.getString("building:material"), source.getString("building:colour"), source.getString("building:part"), source.getString("building:height"), source.getString("height"), source.getString("building:min_height"), source.getString("min_height"), source.getString("building:levels"), source.getString("levels"), source.getString("building:min_level"), source.getString("min_level"), source.getString("building:height"), source.getString("height"), source.getString("building:min_height"), source.getString("min_height"), source.getString("building:levels"), source.getString("levels"), source.getString("building:min_level"), source.getString("min_level"));
public static record OsmAerowayLinestring(
String ref, String aeroway, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmAerowayLinestring(SourceFeature source, String mappingKey) {
this(source.getString("ref"), source.getString("aeroway"), source);
}
public static final Expression MAPPING = matchAny("type", "building");
}
public static record OsmMarinePoint(com.onthegomap.flatmap.SourceFeature source, String name, String nameEn, String nameDe, String place, long rank, boolean isIntermittent) implements Table {
public OsmMarinePoint(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("place"), source.getLong("rank"), source.getBoolean("intermittent"));
public static final Expression MAPPING = and(matchAny("aeroway", "runway", "taxiway"),
matchAny("__linestring", "true"));
public interface Handler {
void process(OsmAerowayLinestring element, FeatureCollector features);
}
public static final Expression MAPPING = and(matchAny("place", "ocean", "sea"), matchField("name"));
}
public static record OsmContinentPoint(com.onthegomap.flatmap.SourceFeature source, String name, String nameEn, String nameDe) implements Table {
public OsmContinentPoint(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("name:en"), source.getString("name:de"));
public static record OsmAerowayPoint(
String ref, String aeroway, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmAerowayPoint(SourceFeature source, String mappingKey) {
this(source.getString("ref"), source.getString("aeroway"), source);
}
public static final Expression MAPPING = and(matchAny("place", "continent"), matchField("name"));
}
public static record OsmCountryPoint(com.onthegomap.flatmap.SourceFeature source, String name, String nameEn, String nameDe, long rank, String countryCodeIso31661Alpha2, String iso31661Alpha2, String iso31661) implements Table {
public OsmCountryPoint(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getLong("rank"), source.getString("country_code_iso3166_1_alpha_2"), source.getString("ISO3166-1:alpha2"), source.getString("ISO3166-1"));
public static final Expression MAPPING = and(matchAny("aeroway", "gate"), matchAny("__point", "true"));
public interface Handler {
void process(OsmAerowayPoint element, FeatureCollector features);
}
public static final Expression MAPPING = and(matchAny("place", "country"), matchField("name"));
}
public static record OsmIslandPolygon(com.onthegomap.flatmap.SourceFeature source, String name, String nameEn, String nameDe, long rank) implements Table {
public OsmIslandPolygon(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getLong("rank"));
public static record OsmHighwayLinestring(
String highway, String construction, String ref, String network, int zOrder, long layer, long level, boolean indoor,
String name, String nameEn, String nameDe, String shortName, boolean isTunnel, boolean isBridge, boolean isRamp,
boolean isFord, int isOneway, boolean isArea, String service, String usage, String publicTransport, String manMade,
String bicycle, String foot, String horse, String mtbScale, String surface,
com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmHighwayLinestring(SourceFeature source, String mappingKey) {
this(source.getString("highway"), source.getString("construction"), source.getString("ref"),
source.getString("network"), source.getWayZorder(), source.getLong("layer"), source.getLong("level"),
source.getBoolean("indoor"), source.getString("name"), source.getString("name:en"), source.getString("name:de"),
source.getString("short_name"), source.getBoolean("tunnel"), source.getBoolean("bridge"),
source.getBoolean("ramp"), source.getBoolean("ford"), source.getDirection("oneway"), source.getBoolean("area"),
source.getString("service"), source.getString("usage"), source.getString("public_transport"),
source.getString("man_made"), source.getString("bicycle"), source.getString("foot"), source.getString("horse"),
source.getString("mtb:scale"), source.getString("surface"), source);
}
public static final Expression MAPPING = and(matchAny("place", "island"), matchField("name"));
}
public static record OsmIslandPoint(com.onthegomap.flatmap.SourceFeature source, String name, String nameEn, String nameDe, long rank) implements Table {
public OsmIslandPoint(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getLong("rank"));
public static final Expression MAPPING = and(or(
matchAny("highway", "motorway", "motorway_link", "trunk", "trunk_link", "primary", "primary_link", "secondary",
"secondary_link", "tertiary", "tertiary_link", "unclassified", "residential", "living_street", "road",
"pedestrian", "path", "footway", "cycleway", "steps", "bridleway", "corridor", "service", "track", "raceway",
"construction"), matchAny("public_transport", "platform"), matchAny("man_made", "pier")),
matchAny("__linestring", "true"));
public interface Handler {
void process(OsmHighwayLinestring element, FeatureCollector features);
}
public static final Expression MAPPING = and(matchAny("place", "island"), matchField("name"));
}
public static record OsmStatePoint(com.onthegomap.flatmap.SourceFeature source, String name, String nameEn, String nameDe, String isInCountry, String isInCountryCode, String ref, long rank) implements Table {
public OsmStatePoint(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("is_in:country"), source.getString("is_in:country_code"), source.getString("ref"), source.getLong("rank"));
public static record OsmRailwayLinestring(
String railway, String ref, String network, int zOrder, long layer, long level, boolean indoor, String name,
String nameEn, String nameDe, String shortName, boolean isTunnel, boolean isBridge, boolean isRamp, boolean isFord,
int isOneway, boolean isArea, String service, String usage, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmRailwayLinestring(SourceFeature source, String mappingKey) {
this(source.getString("railway"), source.getString("ref"), source.getString("network"), source.getWayZorder(),
source.getLong("layer"), source.getLong("level"), source.getBoolean("indoor"), source.getString("name"),
source.getString("name:en"), source.getString("name:de"), source.getString("short_name"),
source.getBoolean("tunnel"), source.getBoolean("bridge"), source.getBoolean("ramp"), source.getBoolean("ford"),
source.getDirection("oneway"), source.getBoolean("area"), source.getString("service"),
source.getString("usage"), source);
}
public static final Expression MAPPING = and(matchAny("place", "state"), matchField("name"));
}
public static record OsmCityPoint(com.onthegomap.flatmap.SourceFeature source, String name, String nameEn, String nameDe, String place, long population, String capital, long rank) implements Table {
public OsmCityPoint(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("place"), source.getLong("population"), source.getString("capital"), source.getLong("rank"));
public static final Expression MAPPING = and(
matchAny("railway", "rail", "narrow_gauge", "preserved", "funicular", "subway", "light_rail", "monorail", "tram"),
matchAny("__linestring", "true"));
public interface Handler {
void process(OsmRailwayLinestring element, FeatureCollector features);
}
public static final Expression MAPPING = and(matchAny("place", "city", "town", "village", "hamlet", "suburb", "quarter", "neighbourhood", "isolated_dwelling"), matchField("name"));
}
public static record OsmHousenumberPoint(com.onthegomap.flatmap.SourceFeature source, String housenumber) implements Table {
public OsmHousenumberPoint(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("addr:housenumber"));
public static record OsmAerialwayLinestring(
String aerialway, int zOrder, long layer, String name, String nameEn, String nameDe, String shortName,
boolean isTunnel, boolean isBridge, boolean isRamp, boolean isFord, int isOneway, boolean isArea, String service,
String usage, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmAerialwayLinestring(SourceFeature source, String mappingKey) {
this(source.getString("aerialway"), source.getWayZorder(), source.getLong("layer"), source.getString("name"),
source.getString("name:en"), source.getString("name:de"), source.getString("short_name"),
source.getBoolean("tunnel"), source.getBoolean("bridge"), source.getBoolean("ramp"), source.getBoolean("ford"),
source.getDirection("oneway"), source.getBoolean("area"), source.getString("service"),
source.getString("usage"), source);
}
public static final Expression MAPPING = or();
}
public static record OsmPoiPoint(com.onthegomap.flatmap.SourceFeature source, String name, String nameEn, String nameDe, String station, String funicular, String information, String uicRef, String religion, long level, boolean indoor, long layer, String sport) implements Table {
public OsmPoiPoint(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("station"), source.getString("funicular"), source.getString("information"), source.getString("uic_ref"), source.getString("religion"), source.getLong("level"), source.getBoolean("indoor"), source.getLong("layer"), source.getString("sport"));
public static final Expression MAPPING = and(matchAny("aerialway", "cable_car", "gondola"),
matchAny("__linestring", "true"));
public interface Handler {
void process(OsmAerialwayLinestring element, FeatureCollector features);
}
public static final Expression MAPPING = or(matchAny("aerialway", "station"), matchAny("amenity", "arts_centre", "bank", "bar", "bbq", "bicycle_parking", "bicycle_rental", "biergarten", "bus_station", "cafe", "cinema", "clinic", "college", "community_centre", "courthouse", "dentist", "doctors", "drinking_water", "embassy", "fast_food", "ferry_terminal", "fire_station", "food_court", "fuel", "grave_yard", "hospital", "ice_cream", "kindergarten", "library", "marketplace", "motorcycle_parking", "nightclub", "nursing_home", "parking", "pharmacy", "place_of_worship", "police", "post_box", "post_office", "prison", "pub", "public_building", "recycling", "restaurant", "school", "shelter", "swimming_pool", "taxi", "telephone", "theatre", "toilets", "townhall", "university", "veterinary", "waste_basket"), matchAny("barrier", "bollard", "border_control", "cycle_barrier", "gate", "lift_gate", "sally_port", "stile", "toll_booth"), matchAny("building", "dormitory"), matchAny("highway", "bus_stop"), matchAny("historic", "monument", "castle", "ruins"), matchAny("landuse", "basin", "brownfield", "cemetery", "reservoir", "winter_sports"), matchAny("leisure", "dog_park", "escape_game", "garden", "golf_course", "ice_rink", "hackerspace", "marina", "miniature_golf", "park", "pitch", "playground", "sports_centre", "stadium", "swimming_area", "swimming_pool", "water_park"), matchAny("railway", "halt", "station", "subway_entrance", "train_station_entrance", "tram_stop"), matchAny("shop", "accessories", "alcohol", "antiques", "art", "bag", "bakery", "beauty", "bed", "beverages", "bicycle", "books", "boutique", "butcher", "camera", "car", "car_repair", "car_parts", "carpet", "charity", "chemist", "chocolate", "clothes", "coffee", "computer", "confectionery", "convenience", "copyshop", "cosmetics", "deli", "delicatessen", "department_store", "doityourself", "dry_cleaning", "electronics", "erotic", "fabric", "florist", "frozen_food", "furniture", "garden_centre", "general", "gift", "greengrocer", "hairdresser", "hardware", "hearing_aids", "hifi", "ice_cream", "interior_decoration", "jewelry", "kiosk", "lamps", "laundry", "mall", "massage", "mobile_phone", "motorcycle", "music", "musical_instrument", "newsagent", "optician", "outdoor", "perfume", "perfumery", "pet", "photo", "second_hand", "shoes", "sports", "stationery", "supermarket", "tailor", "tattoo", "ticket", "tobacco", "toys", "travel_agency", "video", "video_games", "watches", "weapons", "wholesale", "wine"), matchAny("sport", "american_football", "archery", "athletics", "australian_football", "badminton", "baseball", "basketball", "beachvolleyball", "billiards", "bmx", "boules", "bowls", "boxing", "canadian_football", "canoe", "chess", "climbing", "climbing_adventure", "cricket", "cricket_nets", "croquet", "curling", "cycling", "disc_golf", "diving", "dog_racing", "equestrian", "fatsal", "field_hockey", "free_flying", "gaelic_games", "golf", "gymnastics", "handball", "hockey", "horse_racing", "horseshoes", "ice_hockey", "ice_stock", "judo", "karting", "korfball", "long_jump", "model_aerodrome", "motocross", "motor", "multi", "netball", "orienteering", "paddle_tennis", "paintball", "paragliding", "pelota", "racquet", "rc_car", "rowing", "rugby", "rugby_league", "rugby_union", "running", "sailing", "scuba_diving", "shooting", "shooting_range", "skateboard", "skating", "skiing", "soccer", "surfing", "swimming", "table_soccer", "table_tennis", "team_handball", "tennis", "toboggan", "volleyball", "water_ski", "yoga"), matchAny("tourism", "alpine_hut", "aquarium", "artwork", "attraction", "bed_and_breakfast", "camp_site", "caravan_site", "chalet", "gallery", "guest_house", "hostel", "hotel", "information", "motel", "museum", "picnic_site", "theme_park", "viewpoint", "zoo"), matchAny("waterway", "dock"));
}
public static record OsmPoiPolygon(com.onthegomap.flatmap.SourceFeature source, String name, String nameEn, String nameDe, String station, String funicular, String information, String uicRef, String religion, long level, boolean indoor, long layer, String sport) implements Table {
public OsmPoiPolygon(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("station"), source.getString("funicular"), source.getString("information"), source.getString("uic_ref"), source.getString("religion"), source.getLong("level"), source.getBoolean("indoor"), source.getLong("layer"), source.getString("sport"));
public static record OsmShipwayLinestring(
String shipway, int zOrder, long layer, String name, String nameEn, String nameDe, String shortName,
boolean isTunnel, boolean isBridge, boolean isRamp, boolean isFord, int isOneway, boolean isArea, String service,
String usage, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmShipwayLinestring(SourceFeature source, String mappingKey) {
this(source.getString("route"), source.getWayZorder(), source.getLong("layer"), source.getString("name"),
source.getString("name:en"), source.getString("name:de"), source.getString("short_name"),
source.getBoolean("tunnel"), source.getBoolean("bridge"), source.getBoolean("ramp"), source.getBoolean("ford"),
source.getDirection("oneway"), source.getBoolean("area"), source.getString("service"),
source.getString("usage"), source);
}
public static final Expression MAPPING = or(matchAny("aerialway", "station"), matchAny("amenity", "arts_centre", "bank", "bar", "bbq", "bicycle_parking", "bicycle_rental", "biergarten", "bus_station", "cafe", "cinema", "clinic", "college", "community_centre", "courthouse", "dentist", "doctors", "drinking_water", "embassy", "fast_food", "ferry_terminal", "fire_station", "food_court", "fuel", "grave_yard", "hospital", "ice_cream", "kindergarten", "library", "marketplace", "motorcycle_parking", "nightclub", "nursing_home", "parking", "pharmacy", "place_of_worship", "police", "post_box", "post_office", "prison", "pub", "public_building", "recycling", "restaurant", "school", "shelter", "swimming_pool", "taxi", "telephone", "theatre", "toilets", "townhall", "university", "veterinary", "waste_basket"), matchAny("barrier", "bollard", "border_control", "cycle_barrier", "gate", "lift_gate", "sally_port", "stile", "toll_booth"), matchAny("building", "dormitory"), matchAny("highway", "bus_stop"), matchAny("historic", "monument", "castle", "ruins"), matchAny("landuse", "basin", "brownfield", "cemetery", "reservoir", "winter_sports"), matchAny("leisure", "dog_park", "escape_game", "garden", "golf_course", "ice_rink", "hackerspace", "marina", "miniature_golf", "park", "pitch", "playground", "sports_centre", "stadium", "swimming_area", "swimming_pool", "water_park"), matchAny("railway", "halt", "station", "subway_entrance", "train_station_entrance", "tram_stop"), matchAny("shop", "accessories", "alcohol", "antiques", "art", "bag", "bakery", "beauty", "bed", "beverages", "bicycle", "books", "boutique", "butcher", "camera", "car", "car_repair", "car_parts", "carpet", "charity", "chemist", "chocolate", "clothes", "coffee", "computer", "confectionery", "convenience", "copyshop", "cosmetics", "deli", "delicatessen", "department_store", "doityourself", "dry_cleaning", "electronics", "erotic", "fabric", "florist", "frozen_food", "furniture", "garden_centre", "general", "gift", "greengrocer", "hairdresser", "hardware", "hearing_aids", "hifi", "ice_cream", "interior_decoration", "jewelry", "kiosk", "lamps", "laundry", "mall", "massage", "mobile_phone", "motorcycle", "music", "musical_instrument", "newsagent", "optician", "outdoor", "perfume", "perfumery", "pet", "photo", "second_hand", "shoes", "sports", "stationery", "supermarket", "tailor", "tattoo", "ticket", "tobacco", "toys", "travel_agency", "video", "video_games", "watches", "weapons", "wholesale", "wine"), matchAny("sport", "american_football", "archery", "athletics", "australian_football", "badminton", "baseball", "basketball", "beachvolleyball", "billiards", "bmx", "boules", "bowls", "boxing", "canadian_football", "canoe", "chess", "climbing", "climbing_adventure", "cricket", "cricket_nets", "croquet", "curling", "cycling", "disc_golf", "diving", "dog_racing", "equestrian", "fatsal", "field_hockey", "free_flying", "gaelic_games", "golf", "gymnastics", "handball", "hockey", "horse_racing", "horseshoes", "ice_hockey", "ice_stock", "judo", "karting", "korfball", "long_jump", "model_aerodrome", "motocross", "motor", "multi", "netball", "orienteering", "paddle_tennis", "paintball", "paragliding", "pelota", "racquet", "rc_car", "rowing", "rugby", "rugby_league", "rugby_union", "running", "sailing", "scuba_diving", "shooting", "shooting_range", "skateboard", "skating", "skiing", "soccer", "surfing", "swimming", "table_soccer", "table_tennis", "team_handball", "tennis", "toboggan", "volleyball", "water_ski", "yoga"), matchAny("tourism", "alpine_hut", "aquarium", "artwork", "attraction", "bed_and_breakfast", "camp_site", "caravan_site", "chalet", "gallery", "guest_house", "hostel", "hotel", "information", "motel", "museum", "picnic_site", "theme_park", "viewpoint", "zoo"), matchAny("waterway", "dock"));
}
public static record OsmAerodromeLabelPoint(com.onthegomap.flatmap.SourceFeature source, String name, String nameEn, String nameDe, String aerodromeType, String aerodrome, String military, String iata, String icao, String ele) implements Table {
public OsmAerodromeLabelPoint(com.onthegomap.flatmap.SourceFeature source) {
this(source, source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getString("aerodrome:type"), source.getString("aerodrome"), source.getString("military"), source.getString("iata"), source.getString("icao"), source.getString("ele"));
public static final Expression MAPPING = and(matchAny("route", "ferry"), matchAny("__linestring", "true"));
public interface Handler {
void process(OsmShipwayLinestring element, FeatureCollector features);
}
public static final Expression MAPPING = or();
}
public static final MultiExpression<java.util.function.Function<com.onthegomap.flatmap.SourceFeature, Table>> MAPPINGS = MultiExpression.of(Map.ofEntries(
public static record OsmHighwayPolygon(
String highway, int zOrder, long layer, long level, boolean indoor, boolean isArea, String publicTransport,
String manMade, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmHighwayPolygon(SourceFeature source, String mappingKey) {
this(source.getString("highway"), source.getWayZorder(), source.getLong("layer"), source.getLong("level"),
source.getBoolean("indoor"), source.getBoolean("area"), source.getString("public_transport"),
source.getString("man_made"), source);
}
public static final Expression MAPPING = and(
or(matchAny("highway", "path", "cycleway", "bridleway", "footway", "corridor", "pedestrian", "steps"),
matchAny("public_transport", "platform"), matchAny("man_made", "bridge", "pier")),
matchAny("__polygon", "true"));
public interface Handler {
void process(OsmHighwayPolygon element, FeatureCollector features);
}
}
public static record OsmRouteMember(
String ref, String network, String name, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmRouteMember(SourceFeature source, String mappingKey) {
this(source.getString("ref"), source.getString("network"), source.getString("name"), source);
}
public static final Expression MAPPING = and(matchAny("route", "road"), matchAny("__relation_member", "true"));
public interface Handler {
void process(OsmRouteMember element, FeatureCollector features);
}
}
public static record OsmBuildingPolygon(
String material, String colour, String building, String buildingpart, String buildingheight,
String buildingminHeight, String buildinglevels, String buildingminLevel, String height, String minHeight,
String levels, String minLevel, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmBuildingPolygon(SourceFeature source, String mappingKey) {
this(source.getString("building:material"), source.getString("building:colour"), source.getString("building"),
source.getString("building:part"), source.getString("building:height"), source.getString("building:min_height"),
source.getString("building:levels"), source.getString("building:min_level"), source.getString("height"),
source.getString("min_height"), source.getString("levels"), source.getString("min_level"), source);
}
public static final Expression MAPPING = and(
or(matchField("building:part"), matchField("building"), matchAny("aeroway", "terminal", "hangar")),
not(matchAny("building", "no", "none", "No")), not(matchAny("building:part", "no", "none", "No")),
not(matchAny("man_made", "bridge")), matchAny("__polygon", "true"));
public interface Handler {
void process(OsmBuildingPolygon element, FeatureCollector features);
}
}
public static record OsmBuildingRelation(
String building, String material, String colour, String buildingpart, String buildingheight, String height,
String buildingminHeight, String minHeight, String buildinglevels, String levels, String buildingminLevel,
String minLevel, String relbuildingheight, String relheight, String relbuildingminHeight, String relminHeight,
String relbuildinglevels, String rellevels, String relbuildingminLevel, String relminLevel,
com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmBuildingRelation(SourceFeature source, String mappingKey) {
this(source.getString("building"), source.getString("building:material"), source.getString("building:colour"),
source.getString("building:part"), source.getString("building:height"), source.getString("height"),
source.getString("building:min_height"), source.getString("min_height"), source.getString("building:levels"),
source.getString("levels"), source.getString("building:min_level"), source.getString("min_level"),
source.getString("building:height"), source.getString("height"), source.getString("building:min_height"),
source.getString("min_height"), source.getString("building:levels"), source.getString("levels"),
source.getString("building:min_level"), source.getString("min_level"), source);
}
public static final Expression MAPPING = and(matchAny("type", "building"), matchAny("__relation_member", "true"));
public interface Handler {
void process(OsmBuildingRelation element, FeatureCollector features);
}
}
public static record OsmMarinePoint(
String name, String nameEn, String nameDe, String place, long rank, boolean isIntermittent,
com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmMarinePoint(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"),
source.getString("place"), source.getLong("rank"), source.getBoolean("intermittent"), source);
}
public static final Expression MAPPING = and(matchAny("place", "ocean", "sea"), matchField("name"),
matchAny("__point", "true"));
public interface Handler {
void process(OsmMarinePoint element, FeatureCollector features);
}
}
public static record OsmContinentPoint(
String name, String nameEn, String nameDe, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmContinentPoint(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"), source);
}
public static final Expression MAPPING = and(matchAny("place", "continent"), matchField("name"),
matchAny("__point", "true"));
public interface Handler {
void process(OsmContinentPoint element, FeatureCollector features);
}
}
public static record OsmCountryPoint(
String name, String nameEn, String nameDe, long rank, String countryCodeIso31661Alpha2, String iso31661Alpha2,
String iso31661, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmCountryPoint(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getLong("rank"),
source.getString("country_code_iso3166_1_alpha_2"), source.getString("ISO3166-1:alpha2"),
source.getString("ISO3166-1"), source);
}
public static final Expression MAPPING = and(matchAny("place", "country"), matchField("name"),
matchAny("__point", "true"));
public interface Handler {
void process(OsmCountryPoint element, FeatureCollector features);
}
}
public static record OsmIslandPolygon(
String name, String nameEn, String nameDe, long rank, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmIslandPolygon(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getLong("rank"),
source);
}
public static final Expression MAPPING = and(matchAny("place", "island"), matchField("name"),
matchAny("__polygon", "true"));
public interface Handler {
void process(OsmIslandPolygon element, FeatureCollector features);
}
}
public static record OsmIslandPoint(
String name, String nameEn, String nameDe, long rank, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmIslandPoint(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"), source.getLong("rank"),
source);
}
public static final Expression MAPPING = and(matchAny("place", "island"), matchField("name"),
matchAny("__point", "true"));
public interface Handler {
void process(OsmIslandPoint element, FeatureCollector features);
}
}
public static record OsmStatePoint(
String name, String nameEn, String nameDe, String isInCountry, String isInCountryCode, String ref, long rank,
com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmStatePoint(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"),
source.getString("is_in:country"), source.getString("is_in:country_code"), source.getString("ref"),
source.getLong("rank"), source);
}
public static final Expression MAPPING = and(matchAny("place", "state"), matchField("name"),
matchAny("__point", "true"));
public interface Handler {
void process(OsmStatePoint element, FeatureCollector features);
}
}
public static record OsmCityPoint(
String name, String nameEn, String nameDe, String place, long population, String capital, long rank,
com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmCityPoint(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"),
source.getString("place"), source.getLong("population"), source.getString("capital"), source.getLong("rank"),
source);
}
public static final Expression MAPPING = and(
matchAny("place", "city", "town", "village", "hamlet", "suburb", "quarter", "neighbourhood", "isolated_dwelling"),
matchField("name"), matchAny("__point", "true"));
public interface Handler {
void process(OsmCityPoint element, FeatureCollector features);
}
}
public static record OsmHousenumberPoint(String housenumber, com.onthegomap.flatmap.SourceFeature source) implements
Row {
public OsmHousenumberPoint(SourceFeature source, String mappingKey) {
this(source.getString("addr:housenumber"), source);
}
public static final Expression MAPPING = or(and(matchField("addr:housenumber"), matchAny("__points", "true")),
and(matchField("addr:housenumber"), matchAny("__polygons", "true")));
public interface Handler {
void process(OsmHousenumberPoint element, FeatureCollector features);
}
}
public static record OsmPoiPoint(
String name, String nameEn, String nameDe, String subclass, String mappingKey, String station, String funicular,
String information, String uicRef, String religion, long level, boolean indoor, long layer, String sport,
com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmPoiPoint(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"),
source.getString(mappingKey), mappingKey, source.getString("station"), source.getString("funicular"),
source.getString("information"), source.getString("uic_ref"), source.getString("religion"),
source.getLong("level"), source.getBoolean("indoor"), source.getLong("layer"), source.getString("sport"),
source);
}
public static final Expression MAPPING = and(or(matchAny("aerialway", "station"),
matchAny("amenity", "arts_centre", "bank", "bar", "bbq", "bicycle_parking", "bicycle_rental", "biergarten",
"bus_station", "cafe", "cinema", "clinic", "college", "community_centre", "courthouse", "dentist", "doctors",
"drinking_water", "embassy", "fast_food", "ferry_terminal", "fire_station", "food_court", "fuel", "grave_yard",
"hospital", "ice_cream", "kindergarten", "library", "marketplace", "motorcycle_parking", "nightclub",
"nursing_home", "parking", "pharmacy", "place_of_worship", "police", "post_box", "post_office", "prison", "pub",
"public_building", "recycling", "restaurant", "school", "shelter", "swimming_pool", "taxi", "telephone",
"theatre", "toilets", "townhall", "university", "veterinary", "waste_basket"),
matchAny("barrier", "bollard", "border_control", "cycle_barrier", "gate", "lift_gate", "sally_port", "stile",
"toll_booth"), matchAny("building", "dormitory"), matchAny("highway", "bus_stop"),
matchAny("historic", "monument", "castle", "ruins"),
matchAny("landuse", "basin", "brownfield", "cemetery", "reservoir", "winter_sports"),
matchAny("leisure", "dog_park", "escape_game", "garden", "golf_course", "ice_rink", "hackerspace", "marina",
"miniature_golf", "park", "pitch", "playground", "sports_centre", "stadium", "swimming_area", "swimming_pool",
"water_park"), matchAny("railway", "halt", "station", "subway_entrance", "train_station_entrance", "tram_stop"),
matchAny("shop", "accessories", "alcohol", "antiques", "art", "bag", "bakery", "beauty", "bed", "beverages",
"bicycle", "books", "boutique", "butcher", "camera", "car", "car_repair", "car_parts", "carpet", "charity",
"chemist", "chocolate", "clothes", "coffee", "computer", "confectionery", "convenience", "copyshop",
"cosmetics", "deli", "delicatessen", "department_store", "doityourself", "dry_cleaning", "electronics",
"erotic", "fabric", "florist", "frozen_food", "furniture", "garden_centre", "general", "gift", "greengrocer",
"hairdresser", "hardware", "hearing_aids", "hifi", "ice_cream", "interior_decoration", "jewelry", "kiosk",
"lamps", "laundry", "mall", "massage", "mobile_phone", "motorcycle", "music", "musical_instrument", "newsagent",
"optician", "outdoor", "perfume", "perfumery", "pet", "photo", "second_hand", "shoes", "sports", "stationery",
"supermarket", "tailor", "tattoo", "ticket", "tobacco", "toys", "travel_agency", "video", "video_games",
"watches", "weapons", "wholesale", "wine"),
matchAny("sport", "american_football", "archery", "athletics", "australian_football", "badminton", "baseball",
"basketball", "beachvolleyball", "billiards", "bmx", "boules", "bowls", "boxing", "canadian_football", "canoe",
"chess", "climbing", "climbing_adventure", "cricket", "cricket_nets", "croquet", "curling", "cycling",
"disc_golf", "diving", "dog_racing", "equestrian", "fatsal", "field_hockey", "free_flying", "gaelic_games",
"golf", "gymnastics", "handball", "hockey", "horse_racing", "horseshoes", "ice_hockey", "ice_stock", "judo",
"karting", "korfball", "long_jump", "model_aerodrome", "motocross", "motor", "multi", "netball", "orienteering",
"paddle_tennis", "paintball", "paragliding", "pelota", "racquet", "rc_car", "rowing", "rugby", "rugby_league",
"rugby_union", "running", "sailing", "scuba_diving", "shooting", "shooting_range", "skateboard", "skating",
"skiing", "soccer", "surfing", "swimming", "table_soccer", "table_tennis", "team_handball", "tennis",
"toboggan", "volleyball", "water_ski", "yoga"),
matchAny("tourism", "alpine_hut", "aquarium", "artwork", "attraction", "bed_and_breakfast", "camp_site",
"caravan_site", "chalet", "gallery", "guest_house", "hostel", "hotel", "information", "motel", "museum",
"picnic_site", "theme_park", "viewpoint", "zoo"), matchAny("waterway", "dock")), matchAny("__point", "true"));
public interface Handler {
void process(OsmPoiPoint element, FeatureCollector features);
}
}
public static record OsmPoiPolygon(
String name, String nameEn, String nameDe, String subclass, String mappingKey, String station, String funicular,
String information, String uicRef, String religion, long level, boolean indoor, long layer, String sport,
com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmPoiPolygon(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"),
source.getString(mappingKey), mappingKey, source.getString("station"), source.getString("funicular"),
source.getString("information"), source.getString("uic_ref"), source.getString("religion"),
source.getLong("level"), source.getBoolean("indoor"), source.getLong("layer"), source.getString("sport"),
source);
}
public static final Expression MAPPING = and(or(matchAny("aerialway", "station"),
matchAny("amenity", "arts_centre", "bank", "bar", "bbq", "bicycle_parking", "bicycle_rental", "biergarten",
"bus_station", "cafe", "cinema", "clinic", "college", "community_centre", "courthouse", "dentist", "doctors",
"drinking_water", "embassy", "fast_food", "ferry_terminal", "fire_station", "food_court", "fuel", "grave_yard",
"hospital", "ice_cream", "kindergarten", "library", "marketplace", "motorcycle_parking", "nightclub",
"nursing_home", "parking", "pharmacy", "place_of_worship", "police", "post_box", "post_office", "prison", "pub",
"public_building", "recycling", "restaurant", "school", "shelter", "swimming_pool", "taxi", "telephone",
"theatre", "toilets", "townhall", "university", "veterinary", "waste_basket"),
matchAny("barrier", "bollard", "border_control", "cycle_barrier", "gate", "lift_gate", "sally_port", "stile",
"toll_booth"), matchAny("building", "dormitory"), matchAny("highway", "bus_stop"),
matchAny("historic", "monument", "castle", "ruins"),
matchAny("landuse", "basin", "brownfield", "cemetery", "reservoir", "winter_sports"),
matchAny("leisure", "dog_park", "escape_game", "garden", "golf_course", "ice_rink", "hackerspace", "marina",
"miniature_golf", "park", "pitch", "playground", "sports_centre", "stadium", "swimming_area", "swimming_pool",
"water_park"), matchAny("railway", "halt", "station", "subway_entrance", "train_station_entrance", "tram_stop"),
matchAny("shop", "accessories", "alcohol", "antiques", "art", "bag", "bakery", "beauty", "bed", "beverages",
"bicycle", "books", "boutique", "butcher", "camera", "car", "car_repair", "car_parts", "carpet", "charity",
"chemist", "chocolate", "clothes", "coffee", "computer", "confectionery", "convenience", "copyshop",
"cosmetics", "deli", "delicatessen", "department_store", "doityourself", "dry_cleaning", "electronics",
"erotic", "fabric", "florist", "frozen_food", "furniture", "garden_centre", "general", "gift", "greengrocer",
"hairdresser", "hardware", "hearing_aids", "hifi", "ice_cream", "interior_decoration", "jewelry", "kiosk",
"lamps", "laundry", "mall", "massage", "mobile_phone", "motorcycle", "music", "musical_instrument", "newsagent",
"optician", "outdoor", "perfume", "perfumery", "pet", "photo", "second_hand", "shoes", "sports", "stationery",
"supermarket", "tailor", "tattoo", "ticket", "tobacco", "toys", "travel_agency", "video", "video_games",
"watches", "weapons", "wholesale", "wine"),
matchAny("sport", "american_football", "archery", "athletics", "australian_football", "badminton", "baseball",
"basketball", "beachvolleyball", "billiards", "bmx", "boules", "bowls", "boxing", "canadian_football", "canoe",
"chess", "climbing", "climbing_adventure", "cricket", "cricket_nets", "croquet", "curling", "cycling",
"disc_golf", "diving", "dog_racing", "equestrian", "fatsal", "field_hockey", "free_flying", "gaelic_games",
"golf", "gymnastics", "handball", "hockey", "horse_racing", "horseshoes", "ice_hockey", "ice_stock", "judo",
"karting", "korfball", "long_jump", "model_aerodrome", "motocross", "motor", "multi", "netball", "orienteering",
"paddle_tennis", "paintball", "paragliding", "pelota", "racquet", "rc_car", "rowing", "rugby", "rugby_league",
"rugby_union", "running", "sailing", "scuba_diving", "shooting", "shooting_range", "skateboard", "skating",
"skiing", "soccer", "surfing", "swimming", "table_soccer", "table_tennis", "team_handball", "tennis",
"toboggan", "volleyball", "water_ski", "yoga"),
matchAny("tourism", "alpine_hut", "aquarium", "artwork", "attraction", "bed_and_breakfast", "camp_site",
"caravan_site", "chalet", "gallery", "guest_house", "hostel", "hotel", "information", "motel", "museum",
"picnic_site", "theme_park", "viewpoint", "zoo"), matchAny("waterway", "dock")), matchAny("__polygon", "true"));
public interface Handler {
void process(OsmPoiPolygon element, FeatureCollector features);
}
}
public static record OsmAerodromeLabelPoint(
String name, String nameEn, String nameDe, String aerodromeType, String aerodrome, String military, String iata,
String icao, String ele, com.onthegomap.flatmap.SourceFeature source
) implements Row {
public OsmAerodromeLabelPoint(SourceFeature source, String mappingKey) {
this(source.getString("name"), source.getString("name:en"), source.getString("name:de"),
source.getString("aerodrome:type"), source.getString("aerodrome"), source.getString("military"),
source.getString("iata"), source.getString("icao"), source.getString("ele"), source);
}
public static final Expression MAPPING = or(and(matchAny("aeroway", "aerodrome"), matchAny("__points", "true")),
and(matchAny("aeroway", "aerodrome"), matchAny("__polygons", "true")));
public interface Handler {
void process(OsmAerodromeLabelPoint element, FeatureCollector features);
}
}
public static final MultiExpression<Constructor> MAPPINGS = MultiExpression.of(Map.ofEntries(
Map.entry(OsmWaterPolygon::new, OsmWaterPolygon.MAPPING),
Map.entry(OsmWaterwayLinestring::new, OsmWaterwayLinestring.MAPPING),
Map.entry(OsmLandcoverPolygon::new, OsmLandcoverPolygon.MAPPING),
@ -210,4 +732,99 @@ public class Tables {
Map.entry(OsmPoiPolygon::new, OsmPoiPolygon.MAPPING),
Map.entry(OsmAerodromeLabelPoint::new, OsmAerodromeLabelPoint.MAPPING)
));
}
public static Map<Class<? extends Row>, List<RowHandler<? extends Row>>> generateDispatchMap(List<?> handlers) {
Map<Class<? extends Row>, List<RowHandler<? extends Row>>> result = new HashMap<>();
for (var handler : handlers) {
if (handler instanceof OsmWaterPolygon.Handler typedHandler) {
result.computeIfAbsent(OsmWaterPolygon.class, cls -> new ArrayList<>())
.add((RowHandler<OsmWaterPolygon>) typedHandler::process);
} else if (handler instanceof OsmWaterwayLinestring.Handler typedHandler) {
result.computeIfAbsent(OsmWaterwayLinestring.class, cls -> new ArrayList<>())
.add((RowHandler<OsmWaterwayLinestring>) typedHandler::process);
} else if (handler instanceof OsmLandcoverPolygon.Handler typedHandler) {
result.computeIfAbsent(OsmLandcoverPolygon.class, cls -> new ArrayList<>())
.add((RowHandler<OsmLandcoverPolygon>) typedHandler::process);
} else if (handler instanceof OsmLandusePolygon.Handler typedHandler) {
result.computeIfAbsent(OsmLandusePolygon.class, cls -> new ArrayList<>())
.add((RowHandler<OsmLandusePolygon>) typedHandler::process);
} else if (handler instanceof OsmPeakPoint.Handler typedHandler) {
result.computeIfAbsent(OsmPeakPoint.class, cls -> new ArrayList<>())
.add((RowHandler<OsmPeakPoint>) typedHandler::process);
} else if (handler instanceof OsmParkPolygon.Handler typedHandler) {
result.computeIfAbsent(OsmParkPolygon.class, cls -> new ArrayList<>())
.add((RowHandler<OsmParkPolygon>) typedHandler::process);
} else if (handler instanceof OsmBorderDispRelation.Handler typedHandler) {
result.computeIfAbsent(OsmBorderDispRelation.class, cls -> new ArrayList<>())
.add((RowHandler<OsmBorderDispRelation>) typedHandler::process);
} else if (handler instanceof OsmAerowayPolygon.Handler typedHandler) {
result.computeIfAbsent(OsmAerowayPolygon.class, cls -> new ArrayList<>())
.add((RowHandler<OsmAerowayPolygon>) typedHandler::process);
} else if (handler instanceof OsmAerowayLinestring.Handler typedHandler) {
result.computeIfAbsent(OsmAerowayLinestring.class, cls -> new ArrayList<>())
.add((RowHandler<OsmAerowayLinestring>) typedHandler::process);
} else if (handler instanceof OsmAerowayPoint.Handler typedHandler) {
result.computeIfAbsent(OsmAerowayPoint.class, cls -> new ArrayList<>())
.add((RowHandler<OsmAerowayPoint>) typedHandler::process);
} else if (handler instanceof OsmHighwayLinestring.Handler typedHandler) {
result.computeIfAbsent(OsmHighwayLinestring.class, cls -> new ArrayList<>())
.add((RowHandler<OsmHighwayLinestring>) typedHandler::process);
} else if (handler instanceof OsmRailwayLinestring.Handler typedHandler) {
result.computeIfAbsent(OsmRailwayLinestring.class, cls -> new ArrayList<>())
.add((RowHandler<OsmRailwayLinestring>) typedHandler::process);
} else if (handler instanceof OsmAerialwayLinestring.Handler typedHandler) {
result.computeIfAbsent(OsmAerialwayLinestring.class, cls -> new ArrayList<>())
.add((RowHandler<OsmAerialwayLinestring>) typedHandler::process);
} else if (handler instanceof OsmShipwayLinestring.Handler typedHandler) {
result.computeIfAbsent(OsmShipwayLinestring.class, cls -> new ArrayList<>())
.add((RowHandler<OsmShipwayLinestring>) typedHandler::process);
} else if (handler instanceof OsmHighwayPolygon.Handler typedHandler) {
result.computeIfAbsent(OsmHighwayPolygon.class, cls -> new ArrayList<>())
.add((RowHandler<OsmHighwayPolygon>) typedHandler::process);
} else if (handler instanceof OsmRouteMember.Handler typedHandler) {
result.computeIfAbsent(OsmRouteMember.class, cls -> new ArrayList<>())
.add((RowHandler<OsmRouteMember>) typedHandler::process);
} else if (handler instanceof OsmBuildingPolygon.Handler typedHandler) {
result.computeIfAbsent(OsmBuildingPolygon.class, cls -> new ArrayList<>())
.add((RowHandler<OsmBuildingPolygon>) typedHandler::process);
} else if (handler instanceof OsmBuildingRelation.Handler typedHandler) {
result.computeIfAbsent(OsmBuildingRelation.class, cls -> new ArrayList<>())
.add((RowHandler<OsmBuildingRelation>) typedHandler::process);
} else if (handler instanceof OsmMarinePoint.Handler typedHandler) {
result.computeIfAbsent(OsmMarinePoint.class, cls -> new ArrayList<>())
.add((RowHandler<OsmMarinePoint>) typedHandler::process);
} else if (handler instanceof OsmContinentPoint.Handler typedHandler) {
result.computeIfAbsent(OsmContinentPoint.class, cls -> new ArrayList<>())
.add((RowHandler<OsmContinentPoint>) typedHandler::process);
} else if (handler instanceof OsmCountryPoint.Handler typedHandler) {
result.computeIfAbsent(OsmCountryPoint.class, cls -> new ArrayList<>())
.add((RowHandler<OsmCountryPoint>) typedHandler::process);
} else if (handler instanceof OsmIslandPolygon.Handler typedHandler) {
result.computeIfAbsent(OsmIslandPolygon.class, cls -> new ArrayList<>())
.add((RowHandler<OsmIslandPolygon>) typedHandler::process);
} else if (handler instanceof OsmIslandPoint.Handler typedHandler) {
result.computeIfAbsent(OsmIslandPoint.class, cls -> new ArrayList<>())
.add((RowHandler<OsmIslandPoint>) typedHandler::process);
} else if (handler instanceof OsmStatePoint.Handler typedHandler) {
result.computeIfAbsent(OsmStatePoint.class, cls -> new ArrayList<>())
.add((RowHandler<OsmStatePoint>) typedHandler::process);
} else if (handler instanceof OsmCityPoint.Handler typedHandler) {
result.computeIfAbsent(OsmCityPoint.class, cls -> new ArrayList<>())
.add((RowHandler<OsmCityPoint>) typedHandler::process);
} else if (handler instanceof OsmHousenumberPoint.Handler typedHandler) {
result.computeIfAbsent(OsmHousenumberPoint.class, cls -> new ArrayList<>())
.add((RowHandler<OsmHousenumberPoint>) typedHandler::process);
} else if (handler instanceof OsmPoiPoint.Handler typedHandler) {
result.computeIfAbsent(OsmPoiPoint.class, cls -> new ArrayList<>())
.add((RowHandler<OsmPoiPoint>) typedHandler::process);
} else if (handler instanceof OsmPoiPolygon.Handler typedHandler) {
result.computeIfAbsent(OsmPoiPolygon.class, cls -> new ArrayList<>())
.add((RowHandler<OsmPoiPolygon>) typedHandler::process);
} else if (handler instanceof OsmAerodromeLabelPoint.Handler typedHandler) {
result.computeIfAbsent(OsmAerodromeLabelPoint.class, cls -> new ArrayList<>())
.add((RowHandler<OsmAerodromeLabelPoint>) typedHandler::process);
}
}
return result;
}
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class AerodromeLabel implements Layers.AerodromeLabel {
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class Aeroway implements Layers.Aeroway {
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class Boundary implements Layers.Boundary {
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class Building implements Layers.Building {
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class Housenumber implements Layers.Housenumber {
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class Landcover implements Layers.Landcover {
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class Landuse implements Layers.Landuse {
}

Wyświetl plik

@ -0,0 +1,32 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import static com.onthegomap.flatmap.openmaptiles.Utils.coalesce;
import static com.onthegomap.flatmap.openmaptiles.Utils.metersToFeet;
import static com.onthegomap.flatmap.openmaptiles.Utils.nullIf;
import com.onthegomap.flatmap.FeatureCollector;
import com.onthegomap.flatmap.Parse;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
import com.onthegomap.flatmap.openmaptiles.generated.Tables;
public class MountainPeak implements
Layers.MountainPeak,
Tables.OsmPeakPoint.Handler {
@Override
public void process(Tables.OsmPeakPoint element, FeatureCollector features) {
Integer meters = Parse.parseIntSubstring(element.ele());
if (meters != null) {
features.point(LAYER_NAME)
.setAttr(Fields.NAME, element.name())
.setAttr(Fields.NAME_EN, coalesce(nullIf(element.nameEn(), ""), element.name()))
.setAttr(Fields.NAME_DE, coalesce(nullIf(element.nameDe(), ""), element.name()))
.setAttr(Fields.CLASS, element.source().getTag("natural"))
.setAttr(Fields.ELE, meters)
.setAttr(Fields.ELE_FT, metersToFeet(meters))
.setBufferPixels(BUFFER_SIZE)
.setZoomRange(7, 14)
.setLabelGridSizeAndLimit(13, 100, 5);
}
}
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class Park implements Layers.Park {
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class Place implements Layers.Place {
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class Poi implements Layers.Poi {
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class Transportation implements Layers.Transportation {
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class TransportationName implements Layers.TransportationName {
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class Water implements Layers.Water {
}

Wyświetl plik

@ -0,0 +1,6 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class WaterName implements Layers.WaterName {
}

Wyświetl plik

@ -0,0 +1,7 @@
package com.onthegomap.flatmap.openmaptiles.layers;
import com.onthegomap.flatmap.openmaptiles.generated.Layers;
public class Waterway implements Layers.Waterway {
}

Wyświetl plik

@ -1,9 +1,12 @@
package com.onthegomap.flatmap.openmaptiles;
import static com.onthegomap.flatmap.openmaptiles.Expression.*;
import static com.onthegomap.flatmap.openmaptiles.Generate.parseYaml;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.DynamicTest.dynamicTest;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
@ -15,7 +18,7 @@ public class GenerateTest {
@Test
public void testParseSimple() {
MultiExpression<String> parsed = Generate.generateFieldMapping(Generate.parseYaml("""
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
output:
key: value
key2:
@ -32,7 +35,7 @@ public class GenerateTest {
@Test
public void testParseAnd() {
MultiExpression<String> parsed = Generate.generateFieldMapping(Generate.parseYaml("""
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
output:
__AND__:
key1: val1
@ -48,7 +51,7 @@ public class GenerateTest {
@Test
public void testParseAndWithOthers() {
MultiExpression<String> parsed = Generate.generateFieldMapping(Generate.parseYaml("""
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
output:
- key0: val0
- __AND__:
@ -68,7 +71,7 @@ public class GenerateTest {
@Test
public void testParseAndContainingOthers() {
MultiExpression<String> parsed = Generate.generateFieldMapping(Generate.parseYaml("""
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
output:
__AND__:
- key1: val1
@ -89,7 +92,7 @@ public class GenerateTest {
@Test
public void testParseContainsKey() {
MultiExpression<String> parsed = Generate.generateFieldMapping(Generate.parseYaml("""
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
output:
key1: val1
key2:
@ -170,12 +173,53 @@ public class GenerateTest {
)
).stream().map(test -> dynamicTest(test.name, () -> {
Expression parsed = Generate
.parseImposm3MappingExpression(Generate.parseYaml(test.mapping), new Generate.Imposm3Filters(
Generate.parseYaml(test.reject),
Generate.parseYaml(test.require)
.parseImposm3MappingExpression("geometry", parseYaml(test.mapping), new Generate.Imposm3Filters(
parseYaml(test.reject),
parseYaml(test.require)
));
assertEquals(test.expected, parsed);
}));
}
@Test
public void testTypeMappingTopLevelType() {
Expression parsed = Generate
.parseImposm3MappingExpression("point", parseYaml("""
key: val
"""), new Generate.Imposm3Filters(null, null));
assertEquals(and(
matchAny("key", "val"),
matchAny("__point", "true")
), parsed);
}
@Test
public void testTypeMappings() {
Map<String, JsonNode> props = new LinkedHashMap<>();
props.put("point", parseYaml("""
key: val
"""));
props.put("polygon", parseYaml("""
key2: val2
"""));
Expression parsed = Generate
.parseImposm3MappingExpression(new Generate.Imposm3Table(
"geometry",
false,
List.of(),
null,
null,
props
));
assertEquals(or(
and(
matchAny("key", "val"),
matchAny("__point", "true")
),
and(
matchAny("key2", "val2"),
matchAny("__polygon", "true")
)
), parsed);
}
}

Wyświetl plik

@ -172,6 +172,25 @@ public class MultiExpressionTest {
)), index.getMatchesWithTriggers(Map.of("key3", "val3")));
}
@Test
public void testTracksMatchingKeyFromCorrectPath() {
var index = MultiExpression.of(Map.of(
"a", or(
and(
matchAny("key3", "val3"),
matchAny("key2", "val2")
),
and(
matchAny("key1", "val1"),
matchAny("key3", "val3")
)
)
)).index();
assertSameElements(List.of(new MultiExpression.MultiExpressionIndex.MatchWithTriggers<>(
"a", List.of("key1", "key3")
)), index.getMatchesWithTriggers(Map.of("key1", "val1", "key3", "val3")));
}
private static <T> void assertSameElements(List<T> a, List<T> b) {
assertEquals(
a.stream().sorted(Comparator.comparing(Object::toString)).toList(),

Wyświetl plik

@ -0,0 +1,142 @@
package com.onthegomap.flatmap.openmaptiles;
import static com.onthegomap.flatmap.TestUtils.assertSubmap;
import static com.onthegomap.flatmap.TestUtils.newLineString;
import static com.onthegomap.flatmap.TestUtils.newPoint;
import static com.onthegomap.flatmap.openmaptiles.OpenMapTilesProfile.OSM_SOURCE;
import static org.junit.jupiter.api.Assertions.assertEquals;
import com.onthegomap.flatmap.CommonParams;
import com.onthegomap.flatmap.FeatureCollector;
import com.onthegomap.flatmap.SourceFeature;
import com.onthegomap.flatmap.TestUtils;
import com.onthegomap.flatmap.Translations;
import com.onthegomap.flatmap.monitoring.Stats;
import com.onthegomap.flatmap.read.ReaderFeature;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.StreamSupport;
import org.junit.jupiter.api.Test;
public class OpenMaptilesProfileTest {
private final OpenMapTilesProfile profile = new OpenMapTilesProfile(Translations.defaultTranslationProvider());
private final CommonParams params = CommonParams.defaults();
private final Stats stats = new Stats.InMemory();
private final FeatureCollector.Factory featureCollectorFactory = new FeatureCollector.Factory(params, stats);
private static void assertFeatures(int zoom, List<Map<String, Object>> expected, FeatureCollector actual) {
List<FeatureCollector.Feature> actualList = StreamSupport.stream(actual.spliterator(), false).toList();
assertEquals(expected.size(), actualList.size(), "size");
for (int i = 0; i < expected.size(); i++) {
assertSubmap(expected.get(i), TestUtils.toMap(actualList.get(i), zoom));
}
}
@Test
public void testMountainPeak() {
var peak = process(pointFeature(Map.of(
"natural", "peak",
"name", "test",
"ele", "100"
)));
assertFeatures(14, List.of(Map.of(
"name", "test",
"class", "peak",
"ele", 100,
"ele_ft", 328,
"_layer", "mountain_peak",
"_type", "point",
"_minzoom", 7,
"_maxzoom", 14,
"_buffer", 64d,
"_labelgrid_limit", 0
)), peak);
assertFeatures(13, List.of(Map.of(
"_labelgrid_limit", 5,
"_labelgrid_size", 100d
)), peak);
assertFeatures(14, List.of(Map.of(
"class", "volcano"
)), process(pointFeature(Map.of(
"natural", "volcano",
"ele", "100"
))));
assertFeatures(14, List.of(), process(pointFeature(Map.of(
"natural", "volcano"
))));
}
@Test
public void testMountainPeakNames() {
assertFeatures(14, List.of(Map.of(
"name", "name",
"name_en", "english name",
"name_de", "german name"
)), process(pointFeature(Map.of(
"natural", "peak",
"name", "name",
"name:en", "english name",
"name:de", "german name",
"ele", "100"
))));
assertFeatures(14, List.of(Map.of(
"name", "name",
"name_en", "name",
"name_de", "german name"
)), process(pointFeature(Map.of(
"natural", "peak",
"name", "name",
"name:de", "german name",
"ele", "100"
))));
assertFeatures(14, List.of(Map.of(
"name", "name",
"name_en", "name",
"name_de", "name"
)), process(pointFeature(Map.of(
"natural", "peak",
"name", "name",
"ele", "100"
))));
}
@Test
public void testMountainPeakMustBePoint() {
assertFeatures(14, List.of(), process(lineFeature(Map.of(
"natural", "peak",
"name", "name",
"ele", "100"
))));
}
private FeatureCollector process(SourceFeature feature) {
var collector = featureCollectorFactory.get(feature);
profile.processFeature(feature, collector);
return collector;
}
private SourceFeature pointFeature(Map<String, Object> props) {
return new ReaderFeature(
newPoint(0, 0),
new HashMap<>(props),
OSM_SOURCE,
null,
0
);
}
private SourceFeature lineFeature(Map<String, Object> props) {
return new ReaderFeature(
newLineString(0, 0, 1, 1),
new HashMap<>(props),
OSM_SOURCE,
null,
0
);
}
}