Upgrade basemap profile to OpenMapTiles v3.13.1 (#227)

This commit is contained in:
Michael Barry
2022-05-23 12:08:59 +02:00
committed by lazaa32
parent a6c8d6c602
commit 96b1cd684c
9 changed files with 175 additions and 81 deletions

View File

@@ -43,8 +43,8 @@ import static java.util.Map.entry;
import com.carrotsearch.hppc.LongIntMap;
import com.onthegomap.planetiler.FeatureCollector;
import com.onthegomap.planetiler.ForwardingProfile;
import com.onthegomap.planetiler.VectorTile;
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.LanguageUtils;
@@ -68,7 +68,7 @@ public class Poi implements
OpenMapTilesSchema.Poi,
Tables.OsmPoiPoint.Handler,
Tables.OsmPoiPolygon.Handler,
OpenMapTilesProfile.FeaturePostProcessor {
ForwardingProfile.FeaturePostProcessor {
/*
* process() creates the raw POI feature from OSM elements and postProcess()
@@ -136,7 +136,7 @@ public class Poi implements
setupPoiFeature(element, features.centroidIfConvex(LAYER_NAME));
}
private <T extends Tables.WithSubclass & Tables.WithStation & Tables.WithFunicular & Tables.WithSport & Tables.WithInformation & Tables.WithReligion & Tables.WithMappingKey & Tables.WithName & Tables.WithIndoor & Tables.WithLayer & Tables.WithSource> void setupPoiFeature(
private <T extends Tables.WithSubclass & Tables.WithStation & Tables.WithFunicular & Tables.WithSport & Tables.WithInformation & Tables.WithReligion & Tables.WithMappingKey & Tables.WithName & Tables.WithIndoor & Tables.WithLayer & Tables.WithSource & Tables.WithOperator & Tables.WithNetwork> void setupPoiFeature(
T element, FeatureCollector.Feature output) {
String rawSubclass = element.subclass();
if ("station".equals(rawSubclass) && "subway".equals(element.station())) {
@@ -146,6 +146,16 @@ public class Poi implements
rawSubclass = "halt";
}
// ATM names fall back to operator, or else network
String name = element.name();
var tags = element.source().tags();
if ("atm".equals(rawSubclass) && nullOrEmpty(name)) {
name = coalesce(nullIfEmpty(element.operator()), nullIfEmpty(element.network()));
if (name != null) {
tags.put("name", name);
}
}
String subclass = switch (rawSubclass) {
case "information" -> nullIfEmpty(element.information());
case "place_of_worship" -> nullIfEmpty(element.religion());
@@ -154,7 +164,7 @@ public class Poi implements
};
String poiClass = poiClass(rawSubclass, element.mappingKey());
int poiClassRank = poiClassRank(poiClass);
int rankOrder = poiClassRank + ((nullOrEmpty(element.name())) ? 2000 : 0);
int rankOrder = poiClassRank + ((nullOrEmpty(name)) ? 2000 : 0);
output.setBufferPixels(BUFFER_SIZE)
.setAttr(Fields.CLASS, poiClass)

View File

@@ -79,6 +79,7 @@ public class Water implements
case "ne_50m_ocean" -> new WaterInfo(2, 4, FieldValues.CLASS_OCEAN);
case "ne_10m_ocean" -> new WaterInfo(5, 5, FieldValues.CLASS_OCEAN);
// TODO: get OSM ID from low-zoom natural earth lakes
case "ne_110m_lakes" -> new WaterInfo(0, 1, FieldValues.CLASS_LAKE);
case "ne_50m_lakes" -> new WaterInfo(2, 3, FieldValues.CLASS_LAKE);
case "ne_10m_lakes" -> new WaterInfo(4, 5, FieldValues.CLASS_LAKE);
@@ -109,6 +110,7 @@ public class Water implements
.setBufferPixels(BUFFER_SIZE)
.setMinPixelSizeBelowZoom(11, 2)
.setMinZoom(6)
.setAttr(Fields.ID, element.source().id())
.setAttr(Fields.INTERMITTENT, element.isIntermittent() ? 1 : 0)
.setAttrWithMinzoom(Fields.BRUNNEL, Utils.brunnel(element.isBridge(), element.isTunnel()), 12)
.setAttr(Fields.CLASS, clazz);