Prefer OSM translations to wikidata (#55)

This commit is contained in:
Michael Barry
2022-12-03 07:18:32 -05:00
committed by GitHub
parent 7171538bd5
commit e33b2bd2fe
7 changed files with 28 additions and 83 deletions

View File

@@ -416,26 +416,26 @@ public class Generate {
for (var entry : tables.entrySet()) {
String key = entry.getKey();
Imposm3Table table = entry.getValue();
List<OsmTableField> fields = parseTableFields(table);
for (var field : fields) {
String existing = fieldNameToType.get(field.name);
if (existing == null) {
fieldNameToType.put(field.name, field.clazz);
} else if (!existing.equals(field.clazz)) {
throw new IllegalArgumentException(
"Field " + field.name + " has both " + existing + " and " + field.clazz + " types");
}
}
Expression mappingExpression = parseImposm3MappingExpression(table);
String mapping = """
/** Imposm3 "mapping" to filter OSM elements that should appear in this "table". */
public static final Expression MAPPING = %s;
""".formatted(
mappingExpression.generateJavaCode()
);
String tableName = "osm_" + key;
String className = lowerUnderscoreToUpperCamel(tableName);
if (!"relation_member".equals(table.type)) {
List<OsmTableField> fields = parseTableFields(table);
for (var field : fields) {
String existing = fieldNameToType.get(field.name);
if (existing == null) {
fieldNameToType.put(field.name, field.clazz);
} else if (!existing.equals(field.clazz)) {
throw new IllegalArgumentException(
"Field " + field.name + " has both " + existing + " and " + field.clazz + " types");
}
}
Expression mappingExpression = parseImposm3MappingExpression(table);
String mapping = """
/** Imposm3 "mapping" to filter OSM elements that should appear in this "table". */
public static final Expression MAPPING = %s;
""".formatted(
mappingExpression.generateJavaCode()
);
String tableName = "osm_" + key;
String className = lowerUnderscoreToUpperCamel(tableName);
classNames.add(className);
tablesClass.append("""

View File

@@ -851,11 +851,6 @@ public class Tables {
String access();
}
/** Rows with a long adminLevel attribute. */
public interface WithAdminLevel {
long adminLevel();
}
/** Rows with a String aerialway attribute. */
public interface WithAerialway {
String aerialway();
@@ -926,11 +921,6 @@ public class Tables {
String capital();
}
/** Rows with a String claimedBy attribute. */
public interface WithClaimedBy {
String claimedBy();
}
/** Rows with a String colour attribute. */
public interface WithColour {
String colour();
@@ -1151,11 +1141,6 @@ public class Tables {
String operator();
}
/** Rows with a String osmcSymbol attribute. */
public interface WithOsmcSymbol {
String osmcSymbol();
}
/** Rows with a String place attribute. */
public interface WithPlace {
String place();
@@ -1191,51 +1176,11 @@ public class Tables {
String ref();
}
/** Rows with a String relbuildingheight attribute. */
public interface WithRelbuildingheight {
String relbuildingheight();
}
/** Rows with a String relbuildinglevels attribute. */
public interface WithRelbuildinglevels {
String relbuildinglevels();
}
/** Rows with a String relbuildingminHeight attribute. */
public interface WithRelbuildingminHeight {
String relbuildingminHeight();
}
/** Rows with a String relbuildingminLevel attribute. */
public interface WithRelbuildingminLevel {
String relbuildingminLevel();
}
/** Rows with a String relheight attribute. */
public interface WithRelheight {
String relheight();
}
/** Rows with a String religion attribute. */
public interface WithReligion {
String religion();
}
/** Rows with a String rellevels attribute. */
public interface WithRellevels {
String rellevels();
}
/** Rows with a String relminHeight attribute. */
public interface WithRelminHeight {
String relminHeight();
}
/** Rows with a String relminLevel attribute. */
public interface WithRelminLevel {
String relminLevel();
}
/** Rows with a String sacScale attribute. */
public interface WithSacScale {
String sacScale();