mirror of
https://github.com/cfpwastaken/planetiler-openmaptiles.git
synced 2026-02-04 12:31:10 +00:00
Make planetiler-openmaptiles runnable as a standalone project (#19)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.onthegomap.planetiler.openmaptiles;
|
||||
package org.openmaptiles;
|
||||
|
||||
import static com.onthegomap.planetiler.expression.Expression.*;
|
||||
import static java.util.stream.Collectors.joining;
|
||||
@@ -161,9 +161,9 @@ public class Generate {
|
||||
tables.putAll(layer.tables);
|
||||
}
|
||||
|
||||
String packageName = "com.onthegomap.planetiler.openmaptiles.generated";
|
||||
String packageName = "org.openmaptiles.generated";
|
||||
String[] packageParts = packageName.split("\\.");
|
||||
Path output = Path.of("planetiler-openmaptiles", "src", "main", "java")
|
||||
Path output = Path.of("src", "main", "java")
|
||||
.resolve(Path.of(packageParts[0], Arrays.copyOfRange(packageParts, 1, packageParts.length)));
|
||||
|
||||
FileUtils.deleteDirectory(output);
|
||||
@@ -188,7 +188,7 @@ public class Generate {
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.expression.MultiExpression;
|
||||
import com.onthegomap.planetiler.openmaptiles.Layer;
|
||||
import org.openmaptiles.Layer;
|
||||
import com.onthegomap.planetiler.util.Translations;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -225,7 +225,7 @@ public class Generate {
|
||||
info.languages.stream().map(Format::quote).collect(joining(", ")),
|
||||
layers.stream()
|
||||
.map(
|
||||
l -> "new com.onthegomap.planetiler.openmaptiles.layers.%s(translations, config, stats)"
|
||||
l -> "new org.openmaptiles.layers.%s(translations, config, stats)"
|
||||
.formatted(lowerUnderscoreToUpperCamel(l.layer.id)))
|
||||
.collect(joining("," + LINE_SEPARATOR))
|
||||
.indent(6).trim()
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.onthegomap.planetiler.openmaptiles;
|
||||
package org.openmaptiles;
|
||||
|
||||
import com.onthegomap.planetiler.ForwardingProfile;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.onthegomap.planetiler.openmaptiles;
|
||||
package org.openmaptiles;
|
||||
|
||||
import com.onthegomap.planetiler.Planetiler;
|
||||
import com.onthegomap.planetiler.config.Arguments;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import java.nio.file.Path;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
|
||||
/**
|
||||
* Main entrypoint for generating a map using the OpenMapTiles schema.
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.onthegomap.planetiler.openmaptiles;
|
||||
package org.openmaptiles;
|
||||
|
||||
import static com.onthegomap.planetiler.geo.GeoUtils.EMPTY_LINE;
|
||||
import static com.onthegomap.planetiler.geo.GeoUtils.EMPTY_POINT;
|
||||
@@ -10,10 +10,6 @@ import com.onthegomap.planetiler.Planetiler;
|
||||
import com.onthegomap.planetiler.Profile;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.expression.MultiExpression;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.openmaptiles.layers.Transportation;
|
||||
import com.onthegomap.planetiler.openmaptiles.layers.TransportationName;
|
||||
import com.onthegomap.planetiler.reader.SimpleFeature;
|
||||
import com.onthegomap.planetiler.reader.SourceFeature;
|
||||
import com.onthegomap.planetiler.reader.osm.OsmElement;
|
||||
@@ -21,6 +17,10 @@ import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.Translations;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
import org.openmaptiles.layers.Transportation;
|
||||
import org.openmaptiles.layers.TransportationName;
|
||||
|
||||
/**
|
||||
* Delegates the logic for generating a map to individual implementations in the {@code layers} package.
|
||||
@@ -35,17 +35,20 @@ See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for deta
|
||||
*/
|
||||
// AUTOGENERATED BY Generate.java -- DO NOT MODIFY
|
||||
|
||||
package com.onthegomap.planetiler.openmaptiles.generated;
|
||||
package org.openmaptiles.generated;
|
||||
|
||||
import static com.onthegomap.planetiler.expression.Expression.*;
|
||||
import static com.onthegomap.planetiler.expression.Expression.FALSE;
|
||||
import static com.onthegomap.planetiler.expression.Expression.and;
|
||||
import static com.onthegomap.planetiler.expression.Expression.matchAny;
|
||||
import static com.onthegomap.planetiler.expression.Expression.or;
|
||||
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.expression.MultiExpression;
|
||||
import com.onthegomap.planetiler.openmaptiles.Layer;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.Translations;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.openmaptiles.Layer;
|
||||
|
||||
/**
|
||||
* All vector tile layer definitions, attributes, and allowed values generated from the
|
||||
@@ -68,22 +71,22 @@ public class OpenMapTilesSchema {
|
||||
/** Returns a list of expected layer implementation instances from the {@code layers} package. */
|
||||
public static List<Layer> createInstances(Translations translations, PlanetilerConfig config, Stats stats) {
|
||||
return List.of(
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.Water(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.Waterway(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.Landcover(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.Landuse(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.MountainPeak(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.Park(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.Boundary(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.Aeroway(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.Transportation(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.Building(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.WaterName(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.TransportationName(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.Place(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.Housenumber(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.Poi(translations, config, stats),
|
||||
new com.onthegomap.planetiler.openmaptiles.layers.AerodromeLabel(translations, config, stats)
|
||||
new org.openmaptiles.layers.Water(translations, config, stats),
|
||||
new org.openmaptiles.layers.Waterway(translations, config, stats),
|
||||
new org.openmaptiles.layers.Landcover(translations, config, stats),
|
||||
new org.openmaptiles.layers.Landuse(translations, config, stats),
|
||||
new org.openmaptiles.layers.MountainPeak(translations, config, stats),
|
||||
new org.openmaptiles.layers.Park(translations, config, stats),
|
||||
new org.openmaptiles.layers.Boundary(translations, config, stats),
|
||||
new org.openmaptiles.layers.Aeroway(translations, config, stats),
|
||||
new org.openmaptiles.layers.Transportation(translations, config, stats),
|
||||
new org.openmaptiles.layers.Building(translations, config, stats),
|
||||
new org.openmaptiles.layers.WaterName(translations, config, stats),
|
||||
new org.openmaptiles.layers.TransportationName(translations, config, stats),
|
||||
new org.openmaptiles.layers.Place(translations, config, stats),
|
||||
new org.openmaptiles.layers.Housenumber(translations, config, stats),
|
||||
new org.openmaptiles.layers.Poi(translations, config, stats),
|
||||
new org.openmaptiles.layers.AerodromeLabel(translations, config, stats)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for deta
|
||||
*/
|
||||
// AUTOGENERATED BY Generate.java -- DO NOT MODIFY
|
||||
|
||||
package com.onthegomap.planetiler.openmaptiles.generated;
|
||||
package org.openmaptiles.generated;
|
||||
|
||||
import static com.onthegomap.planetiler.expression.Expression.*;
|
||||
|
||||
@@ -33,20 +33,20 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.nullIfEmpty;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.nullOrEmpty;
|
||||
import static org.openmaptiles.util.Utils.nullIfEmpty;
|
||||
import static org.openmaptiles.util.Utils.nullOrEmpty;
|
||||
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.expression.MultiExpression;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.openmaptiles.util.OmtLanguageUtils;
|
||||
import com.onthegomap.planetiler.openmaptiles.util.Utils;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.Translations;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
import org.openmaptiles.util.OmtLanguageUtils;
|
||||
import org.openmaptiles.util.Utils;
|
||||
|
||||
/**
|
||||
* Defines the logic for generating map elements in the {@code aerodrome_label} layer from source features.
|
||||
@@ -33,14 +33,14 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.Translations;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
|
||||
/**
|
||||
* Defines the logic for generating map elements in the {@code aeroway} layer from source features.
|
||||
@@ -33,7 +33,7 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.util.MemoryEstimator.CLASS_HEADER_BYTES;
|
||||
import static com.onthegomap.planetiler.util.MemoryEstimator.POINTER_BYTES;
|
||||
@@ -49,8 +49,6 @@ import com.onthegomap.planetiler.collection.Hppc;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.geo.GeoUtils;
|
||||
import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.reader.SimpleFeature;
|
||||
import com.onthegomap.planetiler.reader.SourceFeature;
|
||||
import com.onthegomap.planetiler.reader.osm.OsmElement;
|
||||
@@ -79,6 +77,8 @@ import org.locationtech.jts.geom.prep.PreparedGeometry;
|
||||
import org.locationtech.jts.geom.prep.PreparedGeometryFactory;
|
||||
import org.locationtech.jts.operation.linemerge.LineMerger;
|
||||
import org.locationtech.jts.operation.polygonize.Polygonizer;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -33,21 +33,18 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.coalesce;
|
||||
import static com.onthegomap.planetiler.util.MemoryEstimator.CLASS_HEADER_BYTES;
|
||||
import static com.onthegomap.planetiler.util.Parse.parseDoubleOrNull;
|
||||
import static java.util.Map.entry;
|
||||
import static org.openmaptiles.util.Utils.coalesce;
|
||||
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
import com.onthegomap.planetiler.FeatureMerge;
|
||||
import com.onthegomap.planetiler.VectorTile;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.reader.osm.OsmElement;
|
||||
import com.onthegomap.planetiler.reader.osm.OsmRelationInfo;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
@@ -56,6 +53,9 @@ import com.onthegomap.planetiler.util.Translations;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
|
||||
/**
|
||||
* Defines the logic for generating map elements for buildings in the {@code building} layer from source features.
|
||||
@@ -33,14 +33,14 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.Translations;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
|
||||
/**
|
||||
* Defines the logic for generating map elements in the {@code housenumber} layer from source features.
|
||||
@@ -33,7 +33,7 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
import com.onthegomap.planetiler.FeatureMerge;
|
||||
@@ -41,9 +41,6 @@ import com.onthegomap.planetiler.VectorTile;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.expression.MultiExpression;
|
||||
import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.reader.SourceFeature;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.Translations;
|
||||
@@ -52,6 +49,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
|
||||
/**
|
||||
* Defines the logic for generating map elements for natural land cover polygons like ice, sand, and forest in the
|
||||
@@ -33,16 +33,13 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.coalesce;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.nullIfEmpty;
|
||||
import static org.openmaptiles.util.Utils.coalesce;
|
||||
import static org.openmaptiles.util.Utils.nullIfEmpty;
|
||||
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.reader.SourceFeature;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.Parse;
|
||||
@@ -50,6 +47,9 @@ import com.onthegomap.planetiler.util.Translations;
|
||||
import com.onthegomap.planetiler.util.ZoomFunction;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
|
||||
/**
|
||||
* Defines the logic for generating map elements for man-made land use polygons like cemeteries, zoos, and hospitals in
|
||||
@@ -33,10 +33,10 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.elevationTags;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.nullIfEmpty;
|
||||
import static org.openmaptiles.util.Utils.elevationTags;
|
||||
import static org.openmaptiles.util.Utils.nullIfEmpty;
|
||||
|
||||
import com.carrotsearch.hppc.LongIntMap;
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
@@ -44,10 +44,6 @@ import com.onthegomap.planetiler.VectorTile;
|
||||
import com.onthegomap.planetiler.collection.Hppc;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.openmaptiles.util.OmtLanguageUtils;
|
||||
import com.onthegomap.planetiler.reader.SourceFeature;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.Parse;
|
||||
@@ -58,6 +54,10 @@ import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.Point;
|
||||
import org.locationtech.jts.geom.prep.PreparedGeometry;
|
||||
import org.locationtech.jts.geom.prep.PreparedGeometryFactory;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
import org.openmaptiles.util.OmtLanguageUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -33,11 +33,11 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.collection.FeatureGroup.SORT_KEY_BITS;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.coalesce;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.nullIfEmpty;
|
||||
import static org.openmaptiles.util.Utils.coalesce;
|
||||
import static org.openmaptiles.util.Utils.nullIfEmpty;
|
||||
|
||||
import com.carrotsearch.hppc.LongIntMap;
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
@@ -48,15 +48,15 @@ import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.geo.GeoUtils;
|
||||
import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.geo.GeometryType;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.openmaptiles.util.OmtLanguageUtils;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.SortKey;
|
||||
import com.onthegomap.planetiler.util.Translations;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
import org.openmaptiles.util.OmtLanguageUtils;
|
||||
|
||||
/**
|
||||
* Defines the logic for generating map elements for designated parks polygons and their label points in the {@code
|
||||
@@ -33,12 +33,12 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.collection.FeatureGroup.SORT_KEY_BITS;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.coalesce;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.nullIfEmpty;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.nullOrEmpty;
|
||||
import static org.openmaptiles.util.Utils.coalesce;
|
||||
import static org.openmaptiles.util.Utils.nullIfEmpty;
|
||||
import static org.openmaptiles.util.Utils.nullOrEmpty;
|
||||
|
||||
import com.carrotsearch.hppc.LongIntMap;
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
@@ -49,10 +49,6 @@ import com.onthegomap.planetiler.geo.GeoUtils;
|
||||
import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.geo.PointIndex;
|
||||
import com.onthegomap.planetiler.geo.PolygonIndex;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.openmaptiles.util.OmtLanguageUtils;
|
||||
import com.onthegomap.planetiler.reader.SourceFeature;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.Parse;
|
||||
@@ -71,6 +67,10 @@ import java.util.stream.DoubleStream;
|
||||
import java.util.stream.Stream;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.locationtech.jts.geom.Point;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
import org.openmaptiles.util.OmtLanguageUtils;
|
||||
|
||||
/**
|
||||
* Defines the logic for generating label points for populated places like continents, countries, cities, and towns in
|
||||
@@ -33,13 +33,13 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.coalesce;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.nullIfEmpty;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.nullIfLong;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.nullOrEmpty;
|
||||
import static java.util.Map.entry;
|
||||
import static org.openmaptiles.util.Utils.coalesce;
|
||||
import static org.openmaptiles.util.Utils.nullIfEmpty;
|
||||
import static org.openmaptiles.util.Utils.nullIfLong;
|
||||
import static org.openmaptiles.util.Utils.nullOrEmpty;
|
||||
|
||||
import com.carrotsearch.hppc.LongIntMap;
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
@@ -48,14 +48,14 @@ import com.onthegomap.planetiler.VectorTile;
|
||||
import com.onthegomap.planetiler.collection.Hppc;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.expression.MultiExpression;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.openmaptiles.util.OmtLanguageUtils;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.Parse;
|
||||
import com.onthegomap.planetiler.util.Translations;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
import org.openmaptiles.util.OmtLanguageUtils;
|
||||
|
||||
/**
|
||||
* Defines the logic for generating map elements for things like shops, parks, and schools in the {@code poi} layer from
|
||||
@@ -33,13 +33,13 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.*;
|
||||
import static com.onthegomap.planetiler.util.MemoryEstimator.CLASS_HEADER_BYTES;
|
||||
import static com.onthegomap.planetiler.util.MemoryEstimator.POINTER_BYTES;
|
||||
import static com.onthegomap.planetiler.util.MemoryEstimator.estimateSize;
|
||||
import static java.util.Map.entry;
|
||||
import static org.openmaptiles.util.Utils.*;
|
||||
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
import com.onthegomap.planetiler.FeatureMerge;
|
||||
@@ -48,9 +48,6 @@ import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.expression.MultiExpression;
|
||||
import com.onthegomap.planetiler.geo.GeoUtils;
|
||||
import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.reader.SourceFeature;
|
||||
import com.onthegomap.planetiler.reader.osm.OsmElement;
|
||||
import com.onthegomap.planetiler.reader.osm.OsmReader;
|
||||
@@ -73,6 +70,9 @@ import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.LineString;
|
||||
import org.locationtech.jts.geom.prep.PreparedGeometry;
|
||||
import org.locationtech.jts.geom.prep.PreparedGeometryFactory;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -33,12 +33,12 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.openmaptiles.layers.Transportation.highwayClass;
|
||||
import static com.onthegomap.planetiler.openmaptiles.layers.Transportation.highwaySubclass;
|
||||
import static com.onthegomap.planetiler.openmaptiles.layers.Transportation.isFootwayOrSteps;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.*;
|
||||
import static org.openmaptiles.layers.Transportation.highwayClass;
|
||||
import static org.openmaptiles.layers.Transportation.highwaySubclass;
|
||||
import static org.openmaptiles.layers.Transportation.isFootwayOrSteps;
|
||||
import static org.openmaptiles.util.Utils.*;
|
||||
|
||||
import com.carrotsearch.hppc.LongArrayList;
|
||||
import com.carrotsearch.hppc.LongByteMap;
|
||||
@@ -50,10 +50,6 @@ import com.onthegomap.planetiler.ForwardingProfile;
|
||||
import com.onthegomap.planetiler.VectorTile;
|
||||
import com.onthegomap.planetiler.collection.Hppc;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.openmaptiles.util.OmtLanguageUtils;
|
||||
import com.onthegomap.planetiler.reader.osm.OsmElement;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.Parse;
|
||||
@@ -64,6 +60,10 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
import org.openmaptiles.util.OmtLanguageUtils;
|
||||
|
||||
/**
|
||||
* Defines the logic for generating map elements for road, shipway, rail, and path names in the {@code
|
||||
@@ -33,7 +33,7 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
import com.onthegomap.planetiler.FeatureMerge;
|
||||
@@ -42,14 +42,14 @@ import com.onthegomap.planetiler.VectorTile;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.expression.MultiExpression;
|
||||
import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.openmaptiles.util.Utils;
|
||||
import com.onthegomap.planetiler.reader.SourceFeature;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.Translations;
|
||||
import java.util.List;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
import org.openmaptiles.util.Utils;
|
||||
|
||||
/**
|
||||
* Defines the logic for generating map elements for oceans and lakes in the {@code water} layer from source features.
|
||||
@@ -33,9 +33,9 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.nullIfEmpty;
|
||||
import static org.openmaptiles.util.Utils.nullIfEmpty;
|
||||
|
||||
import com.carrotsearch.hppc.LongObjectMap;
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
@@ -43,10 +43,6 @@ import com.onthegomap.planetiler.collection.Hppc;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.geo.GeoUtils;
|
||||
import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.openmaptiles.util.OmtLanguageUtils;
|
||||
import com.onthegomap.planetiler.reader.SourceFeature;
|
||||
import com.onthegomap.planetiler.stats.Stats;
|
||||
import com.onthegomap.planetiler.util.Parse;
|
||||
@@ -54,6 +50,10 @@ import com.onthegomap.planetiler.util.Translations;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
import org.openmaptiles.util.OmtLanguageUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -33,9 +33,9 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.nullIfEmpty;
|
||||
import static org.openmaptiles.util.Utils.nullIfEmpty;
|
||||
|
||||
import com.carrotsearch.hppc.LongObjectHashMap;
|
||||
import com.google.common.util.concurrent.AtomicDouble;
|
||||
@@ -45,11 +45,6 @@ import com.onthegomap.planetiler.VectorTile;
|
||||
import com.onthegomap.planetiler.collection.Hppc;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import com.onthegomap.planetiler.openmaptiles.generated.Tables;
|
||||
import com.onthegomap.planetiler.openmaptiles.util.OmtLanguageUtils;
|
||||
import com.onthegomap.planetiler.openmaptiles.util.Utils;
|
||||
import com.onthegomap.planetiler.reader.SourceFeature;
|
||||
import com.onthegomap.planetiler.reader.osm.OsmElement;
|
||||
import com.onthegomap.planetiler.reader.osm.OsmReader;
|
||||
@@ -59,6 +54,11 @@ import com.onthegomap.planetiler.util.Translations;
|
||||
import com.onthegomap.planetiler.util.ZoomFunction;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
import org.openmaptiles.generated.OpenMapTilesSchema;
|
||||
import org.openmaptiles.generated.Tables;
|
||||
import org.openmaptiles.util.OmtLanguageUtils;
|
||||
import org.openmaptiles.util.Utils;
|
||||
|
||||
/**
|
||||
* Defines the logic for generating river map elements in the {@code waterway} layer from source features.
|
||||
@@ -33,10 +33,10 @@ Design license: CC-BY 4.0
|
||||
|
||||
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
|
||||
*/
|
||||
package com.onthegomap.planetiler.openmaptiles.util;
|
||||
package org.openmaptiles.util;
|
||||
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.coalesce;
|
||||
import static com.onthegomap.planetiler.util.LanguageUtils.*;
|
||||
import static org.openmaptiles.util.Utils.coalesce;
|
||||
|
||||
import com.onthegomap.planetiler.util.LanguageUtils;
|
||||
import com.onthegomap.planetiler.util.Translations;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.util;
|
||||
package org.openmaptiles.util;
|
||||
|
||||
import com.onthegomap.planetiler.util.Parse;
|
||||
import java.util.Map;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.util;
|
||||
package org.openmaptiles.util;
|
||||
|
||||
import com.onthegomap.planetiler.mbtiles.Mbtiles;
|
||||
import com.onthegomap.planetiler.mbtiles.Verify;
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.onthegomap.planetiler.openmaptiles;
|
||||
package org.openmaptiles;
|
||||
|
||||
import static com.onthegomap.planetiler.expression.Expression.*;
|
||||
import static com.onthegomap.planetiler.openmaptiles.Generate.parseYaml;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.DynamicTest.dynamicTest;
|
||||
|
||||
@@ -20,7 +19,7 @@ class GenerateTest {
|
||||
|
||||
@Test
|
||||
void testParseSimple() {
|
||||
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
||||
MultiExpression<String> parsed = Generate.generateFieldMapping(Generate.parseYaml("""
|
||||
output:
|
||||
key: value
|
||||
key2:
|
||||
@@ -37,7 +36,7 @@ class GenerateTest {
|
||||
|
||||
@Test
|
||||
void testParseAnd() {
|
||||
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
||||
MultiExpression<String> parsed = Generate.generateFieldMapping(Generate.parseYaml("""
|
||||
output:
|
||||
__AND__:
|
||||
key1: val1
|
||||
@@ -53,7 +52,7 @@ class GenerateTest {
|
||||
|
||||
@Test
|
||||
void testParseAndWithOthers() {
|
||||
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
||||
MultiExpression<String> parsed = Generate.generateFieldMapping(Generate.parseYaml("""
|
||||
output:
|
||||
- key0: val0
|
||||
- __AND__:
|
||||
@@ -73,7 +72,7 @@ class GenerateTest {
|
||||
|
||||
@Test
|
||||
void testParseAndContainingOthers() {
|
||||
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
||||
MultiExpression<String> parsed = Generate.generateFieldMapping(Generate.parseYaml("""
|
||||
output:
|
||||
__AND__:
|
||||
- key1: val1
|
||||
@@ -94,7 +93,7 @@ class GenerateTest {
|
||||
|
||||
@Test
|
||||
void testParseContainsKey() {
|
||||
MultiExpression<String> parsed = Generate.generateFieldMapping(parseYaml("""
|
||||
MultiExpression<String> parsed = Generate.generateFieldMapping(Generate.parseYaml("""
|
||||
output:
|
||||
key1: val1
|
||||
key2:
|
||||
@@ -175,9 +174,9 @@ class GenerateTest {
|
||||
)
|
||||
).map(test -> dynamicTest(test.name, () -> {
|
||||
Expression parsed = Generate
|
||||
.parseImposm3MappingExpression("point", parseYaml(test.mapping), new Generate.Imposm3Filters(
|
||||
parseYaml(test.reject),
|
||||
parseYaml(test.require)
|
||||
.parseImposm3MappingExpression("point", Generate.parseYaml(test.mapping), new Generate.Imposm3Filters(
|
||||
Generate.parseYaml(test.reject),
|
||||
Generate.parseYaml(test.require)
|
||||
));
|
||||
assertEquals(test.expected, parsed.replace(matchType("point"), TRUE).simplify());
|
||||
}));
|
||||
@@ -186,7 +185,7 @@ class GenerateTest {
|
||||
@Test
|
||||
void testTypeMappingTopLevelType() {
|
||||
Expression parsed = Generate
|
||||
.parseImposm3MappingExpression("point", parseYaml("""
|
||||
.parseImposm3MappingExpression("point", Generate.parseYaml("""
|
||||
key: val
|
||||
"""), new Generate.Imposm3Filters(null, null));
|
||||
assertEquals(and(
|
||||
@@ -198,10 +197,10 @@ class GenerateTest {
|
||||
@Test
|
||||
void testTypeMappings() {
|
||||
Map<String, JsonNode> props = new LinkedHashMap<>();
|
||||
props.put("points", parseYaml("""
|
||||
props.put("points", Generate.parseYaml("""
|
||||
key: val
|
||||
"""));
|
||||
props.put("polygons", parseYaml("""
|
||||
props.put("polygons", Generate.parseYaml("""
|
||||
key2: val2
|
||||
"""));
|
||||
Expression parsed = Generate
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.onthegomap.planetiler.openmaptiles;
|
||||
package org.openmaptiles;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.onthegomap.planetiler.openmaptiles;
|
||||
package org.openmaptiles;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.assertContains;
|
||||
import static com.onthegomap.planetiler.TestUtils.assertFeatureNear;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.VerifyMonaco.MONACO_BOUNDS;
|
||||
import static com.onthegomap.planetiler.util.Gzip.gunzip;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.DynamicTest.dynamicTest;
|
||||
@@ -11,7 +10,7 @@ import com.onthegomap.planetiler.TestUtils;
|
||||
import com.onthegomap.planetiler.VectorTile;
|
||||
import com.onthegomap.planetiler.config.Arguments;
|
||||
import com.onthegomap.planetiler.mbtiles.Mbtiles;
|
||||
import com.onthegomap.planetiler.openmaptiles.util.VerifyMonaco;
|
||||
import com.onthegomap.planetiler.util.FileUtils;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
@@ -23,11 +22,13 @@ import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.DynamicTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestFactory;
|
||||
import org.junit.jupiter.api.Timeout;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.LineString;
|
||||
import org.locationtech.jts.geom.Point;
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
import org.openmaptiles.util.VerifyMonaco;
|
||||
|
||||
/**
|
||||
* End-to-end tests for OpenMapTiles generation.
|
||||
@@ -42,22 +43,29 @@ class OpenMapTilesTest {
|
||||
private static Mbtiles mbtiles;
|
||||
|
||||
@BeforeAll
|
||||
@Timeout(30)
|
||||
public static void runPlanetiler() throws Exception {
|
||||
Path dbPath = tmpDir.resolve("output.mbtiles");
|
||||
var osmPath = TestUtils.extractPathToResource(tmpDir, "monaco-latest.osm.pbf");
|
||||
var naturalEarthPath = TestUtils.extractPathToResource(tmpDir, "natural_earth_vector.sqlite.zip");
|
||||
var waterPath = tmpDir.resolve("water");
|
||||
// windows seems to have trouble closing zip file after reading from it, so extract first instead
|
||||
FileUtils.unzipResource("/water-polygons-split-3857.zip", waterPath);
|
||||
OpenMapTilesMain.run(Arguments.of(
|
||||
// Override input source locations
|
||||
"osm_path", TestUtils.pathToResource("monaco-latest.osm.pbf"),
|
||||
"natural_earth_path", TestUtils.pathToResource("natural_earth_vector.sqlite.zip"),
|
||||
"water_polygons_path", TestUtils.pathToResource("water-polygons-split-3857.zip"),
|
||||
"osm_path", osmPath,
|
||||
"natural_earth_path", naturalEarthPath,
|
||||
"water_polygons_path", waterPath,
|
||||
// no centerlines in monaco - so fake it out with an empty source
|
||||
"lake_centerlines_path", TestUtils.pathToResource("water-polygons-split-3857.zip"),
|
||||
"lake_centerlines_path", waterPath,
|
||||
|
||||
// Override temp dir location
|
||||
"tmp", tmpDir.toString(),
|
||||
"tmpdir", tmpDir.resolve("tmp"),
|
||||
|
||||
// Override output location
|
||||
"mbtiles", dbPath.toString()
|
||||
"mbtiles", dbPath
|
||||
));
|
||||
|
||||
mbtiles = Mbtiles.newReadOnlyDatabase(dbPath);
|
||||
}
|
||||
|
||||
@@ -220,6 +228,6 @@ class OpenMapTilesTest {
|
||||
|
||||
private static void assertNumFeatures(String layer, Map<String, Object> attrs, int zoom,
|
||||
int expected, Class<? extends Geometry> clazz) {
|
||||
TestUtils.assertNumFeatures(mbtiles, layer, zoom, attrs, MONACO_BOUNDS, expected, clazz);
|
||||
TestUtils.assertNumFeatures(mbtiles, layer, zoom, attrs, VerifyMonaco.MONACO_BOUNDS, expected, clazz);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.assertSubmap;
|
||||
import static com.onthegomap.planetiler.TestUtils.newLineString;
|
||||
import static com.onthegomap.planetiler.TestUtils.newPoint;
|
||||
import static com.onthegomap.planetiler.TestUtils.rectangle;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.OSM_SOURCE;
|
||||
import static com.onthegomap.planetiler.openmaptiles.util.Utils.coalesce;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
@@ -15,7 +13,6 @@ import com.onthegomap.planetiler.VectorTile;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.geo.GeoUtils;
|
||||
import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.reader.SimpleFeature;
|
||||
import com.onthegomap.planetiler.reader.SourceFeature;
|
||||
import com.onthegomap.planetiler.reader.osm.OsmReader;
|
||||
@@ -29,6 +26,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.StreamSupport;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
import org.openmaptiles.util.Utils;
|
||||
|
||||
public abstract class AbstractLayerTest {
|
||||
|
||||
@@ -45,7 +44,7 @@ public abstract class AbstractLayerTest {
|
||||
static void assertFeatures(int zoom, List<Map<String, Object>> expected, Iterable<FeatureCollector.Feature> actual) {
|
||||
// ensure both are sorted by layer
|
||||
var expectedList =
|
||||
expected.stream().sorted(Comparator.comparing(d -> coalesce(d.get("_layer"), "").toString())).toList();
|
||||
expected.stream().sorted(Comparator.comparing(d -> Utils.coalesce(d.get("_layer"), "").toString())).toList();
|
||||
var actualList = StreamSupport.stream(actual.spliterator(), false)
|
||||
.sorted(Comparator.comparing(FeatureCollector.Feature::getLayer))
|
||||
.toList();
|
||||
@@ -122,7 +121,7 @@ public abstract class AbstractLayerTest {
|
||||
return SimpleFeature.create(
|
||||
newPoint(0, 0),
|
||||
new HashMap<>(props),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
);
|
||||
@@ -132,7 +131,7 @@ public abstract class AbstractLayerTest {
|
||||
return SimpleFeature.create(
|
||||
newLineString(0, 0, 1, 1),
|
||||
new HashMap<>(props),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
);
|
||||
@@ -142,7 +141,7 @@ public abstract class AbstractLayerTest {
|
||||
return SimpleFeature.createFakeOsmFeature(
|
||||
newLineString(0, 0, 1, 0, 1, 1, 0, 1, 0, 0),
|
||||
new HashMap<>(props),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0,
|
||||
null
|
||||
@@ -153,7 +152,7 @@ public abstract class AbstractLayerTest {
|
||||
return SimpleFeature.create(
|
||||
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(area))),
|
||||
new HashMap<>(props),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
);
|
||||
@@ -169,7 +168,7 @@ public abstract class AbstractLayerTest {
|
||||
return SimpleFeature.createFakeOsmFeature(
|
||||
newLineString(0, 0, 1, 1),
|
||||
map,
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0,
|
||||
(relationInfos == null ? List.<OsmRelationInfo>of() : relationInfos).stream()
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.newLineString;
|
||||
import static com.onthegomap.planetiler.TestUtils.rectangle;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.NATURAL_EARTH_SOURCE;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.OSM_SOURCE;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
@@ -18,6 +16,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
|
||||
class BoundaryTest extends AbstractLayerTest {
|
||||
|
||||
@@ -28,21 +27,21 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
process(SimpleFeature.create(
|
||||
newLineString(0, 0, 1, 1),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_110m_admin_0_boundary_lines_land",
|
||||
0
|
||||
)),
|
||||
process(SimpleFeature.create(
|
||||
newLineString(0, 0, 1, 1),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_50m_admin_0_boundary_lines_land",
|
||||
1
|
||||
)),
|
||||
process(SimpleFeature.create(
|
||||
newLineString(0, 0, 1, 1),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_admin_0_boundary_lines_land",
|
||||
2
|
||||
))
|
||||
@@ -62,7 +61,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
Map.of(
|
||||
"featurecla", "International boundary (verify)"
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_110m_admin_0_boundary_lines_land",
|
||||
0
|
||||
)));
|
||||
@@ -79,7 +78,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
Map.of(
|
||||
"featurecla", "Disputed (please verify)"
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_110m_admin_0_boundary_lines_land",
|
||||
0
|
||||
)));
|
||||
@@ -93,7 +92,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
Map.of(
|
||||
"featurecla", "International boundary (verify)"
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_50m_admin_0_boundary_lines_land",
|
||||
0
|
||||
)));
|
||||
@@ -107,7 +106,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
Map.of(
|
||||
"featurecla", "International boundary (verify)"
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_admin_0_boundary_lines_land",
|
||||
0
|
||||
)));
|
||||
@@ -117,7 +116,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
Map.of(
|
||||
"featurecla", "Lease Limit"
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_admin_0_boundary_lines_land",
|
||||
0
|
||||
)));
|
||||
@@ -140,7 +139,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
Map.of(
|
||||
"min_zoom", 7d
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_admin_1_states_provinces_lines",
|
||||
0
|
||||
)));
|
||||
@@ -159,7 +158,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
Map.of(
|
||||
"min_zoom", 7.6d
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_admin_1_states_provinces_lines",
|
||||
0
|
||||
)));
|
||||
@@ -169,7 +168,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
Map.of(
|
||||
"min_zoom", 7.9d
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_admin_1_states_provinces_lines",
|
||||
0
|
||||
)));
|
||||
@@ -177,7 +176,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
assertFeatures(0, List.of(), process(SimpleFeature.create(
|
||||
newLineString(0, 0, 1, 1),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_admin_1_states_provinces_lines",
|
||||
0
|
||||
)));
|
||||
@@ -416,7 +415,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
assertFeatures(14, List.of(), process(SimpleFeature.createFakeOsmFeature(
|
||||
newLineString(0, 0, 0, 10),
|
||||
Map.of(),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
3,
|
||||
Stream.concat(
|
||||
@@ -430,7 +429,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
assertFeatures(14, List.of(), process(SimpleFeature.createFakeOsmFeature(
|
||||
newLineString(0, 0, 5, 10),
|
||||
Map.of(),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
4,
|
||||
profile.preprocessOsmRelation(country1).stream().map(r -> new OsmReader.RelationMember<>("", r))
|
||||
@@ -440,7 +439,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
assertFeatures(14, List.of(), process(SimpleFeature.createFakeOsmFeature(
|
||||
newLineString(0, 10, 5, 10),
|
||||
Map.of(),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
4,
|
||||
profile.preprocessOsmRelation(country1).stream().map(r -> new OsmReader.RelationMember<>("", r))
|
||||
@@ -452,7 +451,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
assertFeatures(14, List.of(), process(SimpleFeature.createFakeOsmFeature(
|
||||
newLineString(0, 0, -5, 10),
|
||||
Map.of(),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
4,
|
||||
profile.preprocessOsmRelation(country2).stream().map(r -> new OsmReader.RelationMember<>("", r))
|
||||
@@ -462,7 +461,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
assertFeatures(14, List.of(), process(SimpleFeature.createFakeOsmFeature(
|
||||
newLineString(0, 10, -5, 10),
|
||||
Map.of(),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
4,
|
||||
profile.preprocessOsmRelation(country2).stream().map(r -> new OsmReader.RelationMember<>("", r))
|
||||
@@ -471,7 +470,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
));
|
||||
|
||||
List<FeatureCollector.Feature> features = new ArrayList<>();
|
||||
profile.finish(OSM_SOURCE, new FeatureCollector.Factory(params, stats), features::add);
|
||||
profile.finish(OpenMapTilesProfile.OSM_SOURCE, new FeatureCollector.Factory(params, stats), features::add);
|
||||
assertEquals(3, features.size());
|
||||
|
||||
// ensure shared edge has country labels on right sides
|
||||
@@ -515,7 +514,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
assertFeatures(14, List.of(), process(SimpleFeature.createFakeOsmFeature(
|
||||
newLineString(0, 0, 0, 10, 5, 5),
|
||||
Map.of(),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
3,
|
||||
profile.preprocessOsmRelation(country1).stream().map(r -> new OsmReader.RelationMember<>("", r))
|
||||
@@ -523,7 +522,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
)));
|
||||
|
||||
List<FeatureCollector.Feature> features = new ArrayList<>();
|
||||
profile.finish(OSM_SOURCE, new FeatureCollector.Factory(params, stats), features::add);
|
||||
profile.finish(OpenMapTilesProfile.OSM_SOURCE, new FeatureCollector.Factory(params, stats), features::add);
|
||||
assertFeatures(0, List.of(Map.of(
|
||||
"adm0_r", "<null>",
|
||||
"adm0_l", "<null>",
|
||||
@@ -546,7 +545,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
assertFeatures(14, List.of(), process(SimpleFeature.createFakeOsmFeature(
|
||||
GeoUtils.polygonToLineString(rectangle(0, 10)),
|
||||
Map.of(),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
3,
|
||||
profile.preprocessOsmRelation(country1).stream().map(r -> new OsmReader.RelationMember<>("", r))
|
||||
@@ -555,7 +554,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
assertFeatures(14, List.of(), process(SimpleFeature.createFakeOsmFeature(
|
||||
GeoUtils.polygonToLineString(rectangle(1, 9)),
|
||||
Map.of(),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
3,
|
||||
profile.preprocessOsmRelation(country1).stream().map(r -> new OsmReader.RelationMember<>("", r))
|
||||
@@ -563,7 +562,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
)));
|
||||
|
||||
List<FeatureCollector.Feature> features = new ArrayList<>();
|
||||
profile.finish(OSM_SOURCE, new FeatureCollector.Factory(params, stats), features::add);
|
||||
profile.finish(OpenMapTilesProfile.OSM_SOURCE, new FeatureCollector.Factory(params, stats), features::add);
|
||||
assertFeatures(0, List.of(Map.of(
|
||||
"adm0_l", "C1",
|
||||
"adm0_r", "<null>"
|
||||
@@ -584,7 +583,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
assertFeatures(14, List.of(), process(SimpleFeature.createFakeOsmFeature(
|
||||
GeoUtils.worldToLatLonCoords(newLineString(0, 0, 0.1, 0, 0.1, 0.1, 0.02, 0.1, 0.02, -0.02)),
|
||||
Map.of(),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
3,
|
||||
profile.preprocessOsmRelation(country1).stream().map(r -> new OsmReader.RelationMember<>("", r))
|
||||
@@ -592,7 +591,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
)));
|
||||
|
||||
List<FeatureCollector.Feature> features = new ArrayList<>();
|
||||
profile.finish(OSM_SOURCE, new FeatureCollector.Factory(params, stats), features::add);
|
||||
profile.finish(OpenMapTilesProfile.OSM_SOURCE, new FeatureCollector.Factory(params, stats), features::add);
|
||||
assertFeatures(0, List.of(Map.of(
|
||||
"adm0_l", "<null>",
|
||||
"adm0_r", "<null>"
|
||||
@@ -610,7 +609,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
assertFeatures(14, List.of(), process(SimpleFeature.createFakeOsmFeature(
|
||||
GeoUtils.worldToLatLonCoords(newLineString(0, 0, 0.1, 0, 0.1, 0.1, 0.2, 0.1, 0.2, -0.2)),
|
||||
Map.of(),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
3,
|
||||
profile.preprocessOsmRelation(country1).stream().map(r -> new OsmReader.RelationMember<>("", r))
|
||||
@@ -620,7 +619,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
assertFeatures(14, List.of(), process(SimpleFeature.createFakeOsmFeature(
|
||||
GeoUtils.worldToLatLonCoords(GeoUtils.polygonToLineString(rectangle(0.2, 0.3))),
|
||||
Map.of(),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
3,
|
||||
profile.preprocessOsmRelation(country1).stream().map(r -> new OsmReader.RelationMember<>("", r))
|
||||
@@ -628,7 +627,7 @@ class BoundaryTest extends AbstractLayerTest {
|
||||
)));
|
||||
|
||||
List<FeatureCollector.Feature> features = new ArrayList<>();
|
||||
profile.finish(OSM_SOURCE, new FeatureCollector.Factory(params, stats), features::add);
|
||||
profile.finish(OpenMapTilesProfile.OSM_SOURCE, new FeatureCollector.Factory(params, stats), features::add);
|
||||
assertFeatures(0, List.of(Map.of(
|
||||
"adm0_l", "<null>",
|
||||
"adm0_r", "<null>"
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.rectangle;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.OSM_SOURCE;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import com.onthegomap.planetiler.VectorTile;
|
||||
import com.onthegomap.planetiler.geo.GeoUtils;
|
||||
@@ -12,7 +10,9 @@ import com.onthegomap.planetiler.reader.osm.OsmElement;
|
||||
import com.onthegomap.planetiler.reader.osm.OsmReader;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
|
||||
class BuildingTest extends AbstractLayerTest {
|
||||
|
||||
@@ -118,7 +118,7 @@ class BuildingTest extends AbstractLayerTest {
|
||||
Map.of(
|
||||
"building", "yes"
|
||||
),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0,
|
||||
relationInfos
|
||||
@@ -142,11 +142,11 @@ class BuildingTest extends AbstractLayerTest {
|
||||
0
|
||||
);
|
||||
|
||||
assertEquals(
|
||||
Assertions.assertEquals(
|
||||
2,
|
||||
profile.postProcessLayerFeatures(Building.LAYER_NAME, 14, List.of(poly1, poly2)).size()
|
||||
);
|
||||
assertEquals(
|
||||
Assertions.assertEquals(
|
||||
1,
|
||||
profile.postProcessLayerFeatures(Building.LAYER_NAME, 13, List.of(poly1, poly2)).size()
|
||||
);
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.rectangle;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.NATURAL_EARTH_SOURCE;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import com.onthegomap.planetiler.VectorTile;
|
||||
import com.onthegomap.planetiler.geo.GeoUtils;
|
||||
@@ -11,7 +9,9 @@ import com.onthegomap.planetiler.reader.SimpleFeature;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
|
||||
class LandcoverTest extends AbstractLayerTest {
|
||||
|
||||
@@ -20,21 +20,21 @@ class LandcoverTest extends AbstractLayerTest {
|
||||
var glacier1 = process(SimpleFeature.create(
|
||||
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_110m_glaciated_areas",
|
||||
0
|
||||
));
|
||||
var glacier2 = process(SimpleFeature.create(
|
||||
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_50m_glaciated_areas",
|
||||
0
|
||||
));
|
||||
var glacier3 = process(SimpleFeature.create(
|
||||
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_glaciated_areas",
|
||||
0
|
||||
));
|
||||
@@ -68,14 +68,14 @@ class LandcoverTest extends AbstractLayerTest {
|
||||
var ice1 = process(SimpleFeature.create(
|
||||
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_50m_antarctic_ice_shelves_polys",
|
||||
0
|
||||
));
|
||||
var ice2 = process(SimpleFeature.create(
|
||||
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_antarctic_ice_shelves_polys",
|
||||
0
|
||||
));
|
||||
@@ -201,7 +201,7 @@ class LandcoverTest extends AbstractLayerTest {
|
||||
|
||||
private void assertMerges(List<Map<String, Object>> expected, List<VectorTile.Feature> in, int zoom)
|
||||
throws GeometryException {
|
||||
assertEquals(expected,
|
||||
Assertions.assertEquals(expected,
|
||||
profile.postProcessLayerFeatures("landcover", zoom, in).stream().map(
|
||||
VectorTile.Feature::attrs)
|
||||
.toList());
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.rectangle;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.NATURAL_EARTH_SOURCE;
|
||||
|
||||
import com.onthegomap.planetiler.geo.GeoUtils;
|
||||
import com.onthegomap.planetiler.reader.SimpleFeature;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
|
||||
class LanduseTest extends AbstractLayerTest {
|
||||
|
||||
@@ -20,14 +20,14 @@ class LanduseTest extends AbstractLayerTest {
|
||||
)), process(SimpleFeature.create(
|
||||
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
|
||||
Map.of("scalerank", 1.9),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_50m_urban_areas",
|
||||
0
|
||||
)));
|
||||
assertFeatures(0, List.of(), process(SimpleFeature.create(
|
||||
GeoUtils.worldToLatLonCoords(rectangle(0, Math.sqrt(1))),
|
||||
Map.of("scalerank", 2.1),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_50m_urban_areas",
|
||||
0
|
||||
)));
|
||||
@@ -1,10 +1,7 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.newPoint;
|
||||
import static com.onthegomap.planetiler.TestUtils.rectangle;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.NATURAL_EARTH_SOURCE;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.OSM_SOURCE;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.onthegomap.planetiler.VectorTile;
|
||||
@@ -13,8 +10,10 @@ import com.onthegomap.planetiler.reader.SimpleFeature;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
|
||||
class MountainPeakTest extends AbstractLayerTest {
|
||||
|
||||
@@ -156,7 +155,7 @@ class MountainPeakTest extends AbstractLayerTest {
|
||||
process(SimpleFeature.create(
|
||||
rectangle(0, 0.1),
|
||||
Map.of("iso_a2", "US"),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_admin_0_countries",
|
||||
0
|
||||
));
|
||||
@@ -173,7 +172,7 @@ class MountainPeakTest extends AbstractLayerTest {
|
||||
"natural", "volcano",
|
||||
"ele", "100"
|
||||
)),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -190,7 +189,7 @@ class MountainPeakTest extends AbstractLayerTest {
|
||||
"natural", "volcano",
|
||||
"ele", "100"
|
||||
)),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -226,9 +225,9 @@ class MountainPeakTest extends AbstractLayerTest {
|
||||
|
||||
@Test
|
||||
void testMountainPeakPostProcessing() throws GeometryException {
|
||||
assertEquals(List.of(), profile.postProcessLayerFeatures(MountainPeak.LAYER_NAME, 13, List.of()));
|
||||
Assertions.assertEquals(List.of(), profile.postProcessLayerFeatures(MountainPeak.LAYER_NAME, 13, List.of()));
|
||||
|
||||
assertEquals(List.of(pointFeature(
|
||||
Assertions.assertEquals(List.of(pointFeature(
|
||||
MountainPeak.LAYER_NAME,
|
||||
Map.of("rank", 1),
|
||||
1
|
||||
@@ -238,7 +237,7 @@ class MountainPeakTest extends AbstractLayerTest {
|
||||
1
|
||||
))));
|
||||
|
||||
assertEquals(List.of(
|
||||
Assertions.assertEquals(List.of(
|
||||
pointFeature(
|
||||
MountainPeak.LAYER_NAME,
|
||||
Map.of("rank", 1, "name", "a"),
|
||||
@@ -273,7 +272,7 @@ class MountainPeakTest extends AbstractLayerTest {
|
||||
|
||||
@Test
|
||||
void testMountainPeakPostProcessingLimitsFeaturesOutsideZoom() throws GeometryException {
|
||||
assertEquals(Lists.newArrayList(
|
||||
Assertions.assertEquals(Lists.newArrayList(
|
||||
new VectorTile.Feature(
|
||||
MountainPeak.LAYER_NAME,
|
||||
1,
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import com.onthegomap.planetiler.geo.GeoUtils;
|
||||
import java.util.List;
|
||||
@@ -1,13 +1,9 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.newPoint;
|
||||
import static com.onthegomap.planetiler.TestUtils.rectangle;
|
||||
import static com.onthegomap.planetiler.collection.FeatureGroup.SORT_KEY_MAX;
|
||||
import static com.onthegomap.planetiler.collection.FeatureGroup.SORT_KEY_MIN;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.NATURAL_EARTH_SOURCE;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.OSM_SOURCE;
|
||||
import static com.onthegomap.planetiler.openmaptiles.layers.Place.getSortKey;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import com.onthegomap.planetiler.geo.GeoUtils;
|
||||
@@ -15,7 +11,9 @@ import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.reader.SimpleFeature;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
|
||||
class PlaceTest extends AbstractLayerTest {
|
||||
|
||||
@@ -53,7 +51,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
"scalerank", 0,
|
||||
"labelrank", 2
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_admin_0_countries",
|
||||
0
|
||||
));
|
||||
@@ -79,7 +77,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
"name:en", "United States of America",
|
||||
"country_code_iso3166_1_alpha_2", "US"
|
||||
),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -105,7 +103,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
"name:en", "United States of America",
|
||||
"country_code_iso3166_1_alpha_2", "US"
|
||||
),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -122,7 +120,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
"labelrank", 2,
|
||||
"datarank", 1
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_admin_1_states_provinces",
|
||||
0
|
||||
));
|
||||
@@ -135,7 +133,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
"labelrank", 8,
|
||||
"datarank", 1
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_admin_1_states_provinces",
|
||||
0
|
||||
));
|
||||
@@ -149,7 +147,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
"name", "Massachusetts",
|
||||
"name:en", "Massachusetts"
|
||||
),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -163,7 +161,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
"name", "Massachusetts",
|
||||
"name:en", "Massachusetts"
|
||||
),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -188,7 +186,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
"name", "Massachusetts",
|
||||
"name:en", "Massachusetts"
|
||||
),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -205,7 +203,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
"labelrank", 3,
|
||||
"datarank", 3
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_admin_1_states_provinces",
|
||||
0
|
||||
));
|
||||
@@ -226,7 +224,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
"wikidata", "Q95027",
|
||||
"name", "Lugo"
|
||||
),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -293,24 +291,24 @@ class PlaceTest extends AbstractLayerTest {
|
||||
void testPlaceSortKeyRanking() {
|
||||
int[] sortKeys = new int[]{
|
||||
// max
|
||||
getSortKey(0, Place.PlaceType.CITY, 1_000_000_000, "name"),
|
||||
Place.getSortKey(0, Place.PlaceType.CITY, 1_000_000_000, "name"),
|
||||
|
||||
getSortKey(0, Place.PlaceType.CITY, 1_000_000_000, "name longer"),
|
||||
getSortKey(0, Place.PlaceType.CITY, 1_000_000_000, "x".repeat(32)),
|
||||
Place.getSortKey(0, Place.PlaceType.CITY, 1_000_000_000, "name longer"),
|
||||
Place.getSortKey(0, Place.PlaceType.CITY, 1_000_000_000, "x".repeat(32)),
|
||||
|
||||
getSortKey(0, Place.PlaceType.CITY, 10_000_000, "name"),
|
||||
getSortKey(0, Place.PlaceType.CITY, 0, "name"),
|
||||
Place.getSortKey(0, Place.PlaceType.CITY, 10_000_000, "name"),
|
||||
Place.getSortKey(0, Place.PlaceType.CITY, 0, "name"),
|
||||
|
||||
getSortKey(0, Place.PlaceType.TOWN, 1_000_000_000, "name"),
|
||||
getSortKey(0, Place.PlaceType.ISOLATED_DWELLING, 1_000_000_000, "name"),
|
||||
getSortKey(0, null, 1_000_000_000, "name"),
|
||||
Place.getSortKey(0, Place.PlaceType.TOWN, 1_000_000_000, "name"),
|
||||
Place.getSortKey(0, Place.PlaceType.ISOLATED_DWELLING, 1_000_000_000, "name"),
|
||||
Place.getSortKey(0, null, 1_000_000_000, "name"),
|
||||
|
||||
getSortKey(1, Place.PlaceType.CITY, 1_000_000_000, "name"),
|
||||
getSortKey(10, Place.PlaceType.CITY, 1_000_000_000, "name"),
|
||||
getSortKey(null, Place.PlaceType.CITY, 1_000_000_000, "name"),
|
||||
Place.getSortKey(1, Place.PlaceType.CITY, 1_000_000_000, "name"),
|
||||
Place.getSortKey(10, Place.PlaceType.CITY, 1_000_000_000, "name"),
|
||||
Place.getSortKey(null, Place.PlaceType.CITY, 1_000_000_000, "name"),
|
||||
|
||||
// min
|
||||
getSortKey(null, null, 0, null),
|
||||
Place.getSortKey(null, null, 0, null),
|
||||
};
|
||||
for (int i = 0; i < sortKeys.length; i++) {
|
||||
if (sortKeys[i] < SORT_KEY_MIN) {
|
||||
@@ -332,7 +330,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
"scalerank", 0,
|
||||
"wikidataid", "Q61"
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_populated_places",
|
||||
0
|
||||
));
|
||||
@@ -366,7 +364,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
"scalerank", 2,
|
||||
"wikidataid", "Q100"
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_populated_places",
|
||||
0
|
||||
));
|
||||
@@ -401,7 +399,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
"population", "667137",
|
||||
"capital", "4"
|
||||
),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -476,9 +474,9 @@ class PlaceTest extends AbstractLayerTest {
|
||||
@Test
|
||||
void testCitySetRankFromGridrank() throws GeometryException {
|
||||
var layerName = Place.LAYER_NAME;
|
||||
assertEquals(List.of(), profile.postProcessLayerFeatures(layerName, 13, List.of()));
|
||||
Assertions.assertEquals(List.of(), profile.postProcessLayerFeatures(layerName, 13, List.of()));
|
||||
|
||||
assertEquals(List.of(pointFeature(
|
||||
Assertions.assertEquals(List.of(pointFeature(
|
||||
layerName,
|
||||
Map.of("rank", 11),
|
||||
1
|
||||
@@ -488,7 +486,7 @@ class PlaceTest extends AbstractLayerTest {
|
||||
1
|
||||
))));
|
||||
|
||||
assertEquals(List.of(
|
||||
Assertions.assertEquals(List.of(
|
||||
pointFeature(
|
||||
layerName,
|
||||
Map.of("rank", 11, "name", "a"),
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.reader.SourceFeature;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
@@ -137,9 +136,9 @@ class PoiTest extends AbstractLayerTest {
|
||||
@Test
|
||||
void testGridRank() throws GeometryException {
|
||||
var layerName = Poi.LAYER_NAME;
|
||||
assertEquals(List.of(), profile.postProcessLayerFeatures(layerName, 13, List.of()));
|
||||
Assertions.assertEquals(List.of(), profile.postProcessLayerFeatures(layerName, 13, List.of()));
|
||||
|
||||
assertEquals(List.of(pointFeature(
|
||||
Assertions.assertEquals(List.of(pointFeature(
|
||||
layerName,
|
||||
Map.of("rank", 1),
|
||||
1
|
||||
@@ -149,7 +148,7 @@ class PoiTest extends AbstractLayerTest {
|
||||
1
|
||||
))));
|
||||
|
||||
assertEquals(List.of(
|
||||
Assertions.assertEquals(List.of(
|
||||
pointFeature(
|
||||
layerName,
|
||||
Map.of("rank", 1, "name", "a"),
|
||||
@@ -1,16 +1,13 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.newLineString;
|
||||
import static com.onthegomap.planetiler.TestUtils.newPoint;
|
||||
import static com.onthegomap.planetiler.TestUtils.rectangle;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.NATURAL_EARTH_SOURCE;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.OSM_SOURCE;
|
||||
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
import com.onthegomap.planetiler.config.Arguments;
|
||||
import com.onthegomap.planetiler.config.PlanetilerConfig;
|
||||
import com.onthegomap.planetiler.geo.GeometryException;
|
||||
import com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile;
|
||||
import com.onthegomap.planetiler.reader.SimpleFeature;
|
||||
import com.onthegomap.planetiler.reader.SourceFeature;
|
||||
import com.onthegomap.planetiler.reader.osm.OsmElement;
|
||||
@@ -21,6 +18,7 @@ import java.util.stream.Stream;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
|
||||
class TransportationTest extends AbstractLayerTest {
|
||||
|
||||
@@ -495,7 +493,7 @@ class TransportationTest extends AbstractLayerTest {
|
||||
FeatureCollector features = process(SimpleFeature.create(
|
||||
newPoint(1, 2),
|
||||
junctionNode.tags(),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
junctionNode.id()
|
||||
));
|
||||
@@ -893,7 +891,7 @@ class TransportationTest extends AbstractLayerTest {
|
||||
process(SimpleFeature.create(
|
||||
rectangle(0, 0.1),
|
||||
Map.of("iso_a2", "GB"),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_admin_0_countries",
|
||||
0
|
||||
));
|
||||
@@ -919,7 +917,7 @@ class TransportationTest extends AbstractLayerTest {
|
||||
"oneway", "yes",
|
||||
"ref", "M1"
|
||||
),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -945,7 +943,7 @@ class TransportationTest extends AbstractLayerTest {
|
||||
"oneway", "yes",
|
||||
"ref", "M1"
|
||||
),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -1,10 +1,7 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.newLineString;
|
||||
import static com.onthegomap.planetiler.TestUtils.rectangle;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.LAKE_CENTERLINE_SOURCE;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.NATURAL_EARTH_SOURCE;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.OSM_SOURCE;
|
||||
|
||||
import com.onthegomap.planetiler.TestUtils;
|
||||
import com.onthegomap.planetiler.geo.GeoUtils;
|
||||
@@ -14,6 +11,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
|
||||
class WaterNameTest extends AbstractLayerTest {
|
||||
|
||||
@@ -60,7 +58,7 @@ class WaterNameTest extends AbstractLayerTest {
|
||||
new HashMap<>(Map.<String, Object>of(
|
||||
"OSM_ID", -10
|
||||
)),
|
||||
LAKE_CENTERLINE_SOURCE,
|
||||
OpenMapTilesProfile.LAKE_CENTERLINE_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -84,7 +82,7 @@ class WaterNameTest extends AbstractLayerTest {
|
||||
"natural", "water",
|
||||
"water", "pond"
|
||||
)),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
10
|
||||
)));
|
||||
@@ -97,7 +95,7 @@ class WaterNameTest extends AbstractLayerTest {
|
||||
new HashMap<>(Map.<String, Object>of(
|
||||
"OSM_ID", -10
|
||||
)),
|
||||
LAKE_CENTERLINE_SOURCE,
|
||||
OpenMapTilesProfile.LAKE_CENTERLINE_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -106,7 +104,7 @@ class WaterNameTest extends AbstractLayerTest {
|
||||
new HashMap<>(Map.<String, Object>of(
|
||||
"OSM_ID", -10
|
||||
)),
|
||||
LAKE_CENTERLINE_SOURCE,
|
||||
OpenMapTilesProfile.LAKE_CENTERLINE_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -134,7 +132,7 @@ class WaterNameTest extends AbstractLayerTest {
|
||||
"natural", "water",
|
||||
"water", "pond"
|
||||
)),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
10
|
||||
)));
|
||||
@@ -148,7 +146,7 @@ class WaterNameTest extends AbstractLayerTest {
|
||||
"scalerank", 1,
|
||||
"name", "Black sea"
|
||||
)),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_geography_marine_polys",
|
||||
0
|
||||
)));
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.rectangle;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.NATURAL_EARTH_SOURCE;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.OSM_SOURCE;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.WATER_POLYGON_SOURCE;
|
||||
|
||||
import com.onthegomap.planetiler.geo.GeoUtils;
|
||||
import com.onthegomap.planetiler.reader.SimpleFeature;
|
||||
@@ -11,6 +8,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
|
||||
class WaterTest extends AbstractLayerTest {
|
||||
|
||||
@@ -26,7 +24,7 @@ class WaterTest extends AbstractLayerTest {
|
||||
)), process(SimpleFeature.create(
|
||||
rectangle(0, 10),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_110m_lakes",
|
||||
0
|
||||
)));
|
||||
@@ -40,7 +38,7 @@ class WaterTest extends AbstractLayerTest {
|
||||
)), process(SimpleFeature.create(
|
||||
rectangle(0, 10),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_110m_ocean",
|
||||
0
|
||||
)));
|
||||
@@ -53,7 +51,7 @@ class WaterTest extends AbstractLayerTest {
|
||||
)), process(SimpleFeature.create(
|
||||
rectangle(0, 10),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_lakes",
|
||||
0
|
||||
)));
|
||||
@@ -66,7 +64,7 @@ class WaterTest extends AbstractLayerTest {
|
||||
)), process(SimpleFeature.create(
|
||||
rectangle(0, 10),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_ocean",
|
||||
0
|
||||
)));
|
||||
@@ -84,7 +82,7 @@ class WaterTest extends AbstractLayerTest {
|
||||
)), process(SimpleFeature.create(
|
||||
rectangle(0, 10),
|
||||
Map.of(),
|
||||
WATER_POLYGON_SOURCE,
|
||||
OpenMapTilesProfile.WATER_POLYGON_SOURCE,
|
||||
null,
|
||||
0
|
||||
)));
|
||||
@@ -106,7 +104,7 @@ class WaterTest extends AbstractLayerTest {
|
||||
"natural", "water",
|
||||
"water", "reservoir"
|
||||
)),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
id
|
||||
)));
|
||||
@@ -215,28 +213,28 @@ class WaterTest extends AbstractLayerTest {
|
||||
process(SimpleFeature.create(
|
||||
rectangle(0, 10),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_110m_ocean",
|
||||
0
|
||||
)),
|
||||
process(SimpleFeature.create(
|
||||
rectangle(0, 10),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_50m_ocean",
|
||||
0
|
||||
)),
|
||||
process(SimpleFeature.create(
|
||||
rectangle(0, 10),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_ocean",
|
||||
0
|
||||
)),
|
||||
process(SimpleFeature.create(
|
||||
rectangle(0, 10),
|
||||
Map.of(),
|
||||
WATER_POLYGON_SOURCE,
|
||||
OpenMapTilesProfile.WATER_POLYGON_SOURCE,
|
||||
null,
|
||||
0
|
||||
))
|
||||
@@ -249,21 +247,21 @@ class WaterTest extends AbstractLayerTest {
|
||||
process(SimpleFeature.create(
|
||||
rectangle(0, 10),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_110m_lakes",
|
||||
0
|
||||
)),
|
||||
process(SimpleFeature.create(
|
||||
rectangle(0, 10),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_50m_lakes",
|
||||
0
|
||||
)),
|
||||
process(SimpleFeature.create(
|
||||
rectangle(0, 10),
|
||||
Map.of(),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_10m_lakes",
|
||||
0
|
||||
)),
|
||||
@@ -273,7 +271,7 @@ class WaterTest extends AbstractLayerTest {
|
||||
"natural", "water",
|
||||
"water", "reservoir"
|
||||
),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0
|
||||
))
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.layers;
|
||||
package org.openmaptiles.layers;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.newLineString;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.NATURAL_EARTH_SOURCE;
|
||||
import static com.onthegomap.planetiler.openmaptiles.OpenMapTilesProfile.OSM_SOURCE;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import com.onthegomap.planetiler.FeatureCollector;
|
||||
@@ -18,6 +16,7 @@ import java.util.Map;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
import org.openmaptiles.OpenMapTilesProfile;
|
||||
|
||||
class WaterwayTest extends AbstractLayerTest {
|
||||
|
||||
@@ -33,7 +32,7 @@ class WaterwayTest extends AbstractLayerTest {
|
||||
FeatureCollector features = process(SimpleFeature.createFakeOsmFeature(
|
||||
newLineString(0, 0, 0, isLongEnough ? 3 : 1),
|
||||
Map.of(),
|
||||
OSM_SOURCE,
|
||||
OpenMapTilesProfile.OSM_SOURCE,
|
||||
null,
|
||||
0,
|
||||
(relationInfos == null ? List.<OsmRelationInfo>of() : relationInfos).stream()
|
||||
@@ -209,7 +208,7 @@ class WaterwayTest extends AbstractLayerTest {
|
||||
"featurecla", "River",
|
||||
"name", "name"
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_110m_rivers_lake_centerlines",
|
||||
0
|
||||
)));
|
||||
@@ -228,7 +227,7 @@ class WaterwayTest extends AbstractLayerTest {
|
||||
"featurecla", "River",
|
||||
"name", "name"
|
||||
),
|
||||
NATURAL_EARTH_SOURCE,
|
||||
OpenMapTilesProfile.NATURAL_EARTH_SOURCE,
|
||||
"ne_50m_rivers_lake_centerlines",
|
||||
0
|
||||
)));
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.util;
|
||||
package org.openmaptiles.util;
|
||||
|
||||
import static com.onthegomap.planetiler.TestUtils.assertSubmap;
|
||||
import static com.onthegomap.planetiler.util.LanguageUtils.containsOnlyLatinCharacters;
|
||||
@@ -78,6 +78,7 @@ class OmtLanguageUtilsTest {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ParameterizedTest
|
||||
@CsvSource(value = {
|
||||
"abcaāíìś+, null",
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.onthegomap.planetiler.openmaptiles.util;
|
||||
package org.openmaptiles.util;
|
||||
|
||||
import static com.onthegomap.planetiler.geo.GeoUtils.point;
|
||||
import static com.onthegomap.planetiler.util.Gzip.gzip;
|
||||
Reference in New Issue
Block a user