Skip to content

Commit

Permalink
A roads instead of E roads
Browse files Browse the repository at this point in the history
  • Loading branch information
vycius committed May 2, 2024
1 parent 83d0a81 commit 76e7d28
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public void processFeature(SourceFeature sf, FeatureCollector features) {

public static void addFeature(String clazz, String subclass, int transportMinZoom, SourceFeature sf, FeatureCollector features) {
var name = nullIfEmpty(sf.getString("VARDAS"));
var rawRef = Utils.coalesce(nullIfEmpty(sf.getString("ENUMERIS")), nullIfEmpty(sf.getString("NUMERIS")));
var ref = nullIfEmpty(sf.getString("NUMERIS"));

if (Utils.coalesce(name, rawRef) == null) {
if (Utils.coalesce(name, ref) == null) {
return;
}

Expand All @@ -37,14 +37,13 @@ public static void addFeature(String clazz, String subclass, int transportMinZoo
.setMinPixelSize(0.0)
.setPixelTolerance(0.0);

if (rawRef != null) {
if (ref != null) {
// Handle cases like E67/E272 by getting first road number
var ref = rawRef.contains("/") ? rawRef.split("/")[0] : rawRef;
var minZoom = getRefMinZoom(rawRef);
var minZoom = getRefMinZoom(ref);

feature.setAttr(Fields.REF, ref)
.setAttr(Fields.REF_LENGTH, ref.length())
.setMinZoom(getRefMinZoom(rawRef))
.setMinZoom(getRefMinZoom(ref))
.setSortKeyDescending(minZoom);
} else {
feature.putAttrs(LanguageUtils.getNames(sf.tags()))
Expand All @@ -53,10 +52,8 @@ public static void addFeature(String clazz, String subclass, int transportMinZoo
}

private static int getRefMinZoom(String ref) {
if (ref.startsWith("E")) {
if (ref.startsWith("A")) {
return 8;
} else if (ref.startsWith("A")) {
return 9;
} else {
return 11;
}
Expand Down

0 comments on commit 76e7d28

Please sign in to comment.