Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a translation for power=minor_line #5535

Merged
merged 1 commit into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions translations/ggdm30.js
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,8 @@ ggdm30 = {
['t.boundary == "protected_area" && !(t.protect_class)','t.protect_class = "4"'],
['t.bunker_type && !(t.military)','t.military = "bunker"'],
['t.defensive','t.man_made = "tower";t["tower:type"] = "defensive"'],
['t.cable =="yes" && t["cable:type"] == "power"',' t.power = "line"; delete t.cable; delete t["cable:type"]'],
['t.cable =="yes" && t["cable:type"] == "power"',' t.power = "minor_line"; delete t.cable; delete t["cable:type"]'],
['t.cable =="yes" && t["cable:type"] == "transmission"',' t.power = "line"; delete t.cable; delete t["cable:type"]'],
['t.control_tower == "yes" && t.use == "air_traffic_control"','t["tower:type"] = "observation"'],
['t.crossing == "tank"','t.highway = "crossing"'],
['t.desert_surface','t.surface = t.desert_surface; delete t.desert_surface'],
Expand Down Expand Up @@ -1510,7 +1511,8 @@ ggdm30 = {
['t.natural == "spring" && !(t["spring:type"])','t["spring:type"] = "spring"'],
['t.power == "pole"','t["cable:type"] = "power"; t["tower:shape"] = "pole"'],
['t.power == "tower"','t["cable:type"] = "power"'],
['t.power == "line"','t["cable:type"] = "power"; t.cable = "yes"; delete t.power'],
['t.power == "line"','t["cable:type"] = "transmission"; t.cable = "yes"; delete t.power'],
['t.power == "minor_line"','t["cable:type"] = "power"; t.cable = "yes"; delete t.power'],
['t.rapids == "yes"','t.waterway = "rapids"; delete t.rapids'],
['t.railway == "station"','t.public_transport = "station"; t["transport:type"] = "railway"'],
['t.railway == "level_crossing"','t["transport:type"] = "railway";t["transport:type2"] = "road"; a.F_CODE = "AQ062"; delete t.railway'],
Expand Down
18 changes: 15 additions & 3 deletions translations/mgcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ mgcp = {
// print(mgcp.layerNameLookup);
// print('###');

// Quick lookup list for valid FCODES
// mgcp.fcodeList = translate.makeFcodeList(mgcp.rawSchema);
// Yet Another lookup. FCODE and English name
// Used for O2S reasons
mgcp.fcodeNameLookup = translate.makeFcodeNameLookup(mgcp.rawSchema);
// print("mgcp.fcodeNameLookup");
// translate.dumpLookup(mgcp.fcodeNameLookup);
// print("##########");

// Now add an o2s[A,L,P] feature to the mgcp.rawSchema and an attribute to hold OSM tags
// if (config.getOgrOutputFormat() == 'shp')
Expand Down Expand Up @@ -1327,6 +1331,7 @@ mgcp = {
["t.natural == 'spring' && !(t['spring:type'])","t['spring:type'] = 'spring'"],
// ["t.power == 'generator'","a.F_CODE = 'AL015'; t.use = 'power_generation'"],
//["t.power == 'line'","t['cable:type'] = 'power'; t.cable = 'yes'"],
["t.power == 'minor_line'","t.spower = 'minor_line'"],
["t.rapids == 'yes'","t.waterway = 'rapids'"],
["t.resource","t.product = t.resource; delete t.resource"],
["t.route == 'road' && !(t.highway)","t.highway = 'road'; delete t.route"],
Expand Down Expand Up @@ -2385,6 +2390,13 @@ mgcp = {
notUsedTags.gauge = tags.gauge;
}
}

// Uglyness needed to save a powerline type
if (tags.spower)
{
notUsedTags.power = tags.spower;
delete notUsedTags.spower;
}
}, // End of applyToOgrPostProcessing

// ##### End of the xxToOgrxx Block #####
Expand Down Expand Up @@ -2786,7 +2798,7 @@ mgcp = {
}
else
{
tags.o2s_reason = geometryType + ' geometry is not valid for ' + attrs.F_CODE;
tags.o2s_reason = geometryType + ' geometry is not valid for ' + attrs.F_CODE + ' (' + mgcp.fcodeNameLookup[attrs.F_CODE] + ')';;
}

tableName = 'o2s_' + geometryType.toString().charAt(0);
Expand Down
1 change: 1 addition & 0 deletions translations/mgcp_rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ mgcp.rules = {
// ['F_CODE','AP050','highway','cycleway'],
// ['F_CODE','AP050','highway','footway'],
['F_CODE','AQ125','amenity','bus_station'],
['F_CODE','AT030','power','minor_line'], // Power Line - NFDD AT005
['F_CODE','BA010','natural','land_water_boundary'], // Land/Water Boundary - old translation
['F_CODE','BA030','place','islet'], // From OSM
['F_CODE','BA040','water','tidal'], // Tidal Water
Expand Down
6 changes: 4 additions & 2 deletions translations/tds40.js
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,8 @@ tds40 = {
['t.amenity == "stop" && t["transport:type"] == "bus"','t.highway = "bus_stop";'],
['t.boundary == "protected_area" && !(t.protect_class)','t.protect_class = "4";'],
['t["bridge:movable"] && t["bridge:movable"] !== "no" && t["bridge:movable"] !== "unknown"','t.bridge = "movable"'],
['t.cable =="yes" && t["cable:type"] == "power"',' t.power = "line"; delete t.cable; delete t["cable:type"]'],
['t.cable =="yes" && t["cable:type"] == "power"',' t.power = "minor_line"; delete t.cable; delete t["cable:type"]'],
['t.cable =="yes" && t["cable:type"] == "transmission"',' t.power = "line"; delete t.cable; delete t["cable:type"]'],
['t.control_tower == "yes" && t.use == "air_traffic_control"','t["tower:type"] = "observation"'],
['t.desert_surface','t.surface = t.desert_surface; delete t.desert_surface'],
['t.diplomatic && !(t.amenity)','t.amenity = "embassy"'],
Expand Down Expand Up @@ -1530,7 +1531,8 @@ tds40 = {
['t.natural == "spring" && !(t["spring:type"])','t["spring:type"] = "spring"'],
['t.power == "pole"','t["cable:type"] = "power";t["tower:shape"] = "pole"'],
['t.power == "tower"','t["cable:type"] = "power"; t.pylon = "yes"; delete t.power'],
['t.power == "line"','t["cable:type"] = "power", t.cable = "yes"; delete t.power'],
['t.power == "line"','t["cable:type"] = "transmission", t.cable = "yes"; delete t.power'],
['t.power == "minor_line"','t["cable:type"] = "power", t.cable = "yes"; delete t.power'],
['t.rapids == "yes"','t.waterway = "rapids"; delete t.rapids'],
['t.railway == "station"','t.public_transport = "station"; t["transport:type"] = "railway"'],
['t.railway == "level_crossing"','t["transport:type"] = "railway";t["transport:type:2"] = "road"; a.F_CODE = "AQ062"; delete t.railway'],
Expand Down
6 changes: 4 additions & 2 deletions translations/tds61.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,8 @@ tds61 = {
['t.boundary == "protected_area" && !(t.protect_class)','t.protect_class = "4"'],
['t.bunker_type && !(t.military)','t.military = "bunker"'],
['t.defensive','t.man_made = "tower";t["tower:type"] = "defensive"'],
['t.cable =="yes" && t["cable:type"] == "power"',' t.power = "line"; delete t.cable; delete t["cable:type"]'],
['t.cable =="yes" && t["cable:type"] == "power"',' t.power = "minor_line"; delete t.cable; delete t["cable:type"]'],
['t.cable =="yes" && t["cable:type"] == "transmission"',' t.power = "line"; delete t.cable; delete t["cable:type"]'],
['t.control_tower == "yes" && t.use == "air_traffic_control"','t["tower:type"] = "observation"'],
['t.crossing == "tank"','t.highway = "crossing"'],
['t.desert_surface','t.surface = t.desert_surface; delete t.desert_surface'],
Expand Down Expand Up @@ -1527,7 +1528,8 @@ tds61 = {
['t.natural == "spring" && !(t["spring:type"])','t["spring:type"] = "spring"'],
['t.power == "pole"','t["cable:type"] = "power"; t["tower:shape"] = "pole"'],
['t.power == "tower"','t["cable:type"] = "power"; t.pylon = "yes"; delete t.power'],
['t.power == "line"','t["cable:type"] = "power"; t.cable = "yes"; delete t.power'],
['t.power == "minor_line"','t["cable:type"] = "power"; t.cable = "yes"; delete t.power'],
['t.power == "line"','t["cable:type"] = "transmission"; t.cable = "yes"; delete t.power'],
// ['t.power == "generator"','t.use = "power_generation"; a.F_CODE = "AL013"'],
['t.rapids == "yes"','t.waterway = "rapids"; delete t.rapids'],
['t.railway == "station"','t.public_transport = "station"; t["transport:type"] = "railway"'],
Expand Down
6 changes: 4 additions & 2 deletions translations/tds70.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,8 @@ tds70 = {
['t.boundary == "protected_area" && !(t.protect_class)','t.protect_class = "4"'],
['t.bunker_type && !(t.military)','t.military = "bunker"'],
['t.defensive','t.man_made = "tower";t["tower:type"] = "defensive"'],
['t.cable =="yes" && t["cable:type"] == "power"',' t.power = "line"; delete t.cable; delete t["cable:type"]'],
['t.cable =="yes" && t["cable:type"] == "power"',' t.power = "minor_line"; delete t.cable; delete t["cable:type"]'],
['t.cable =="yes" && t["cable:type"] == "transmission"',' t.power = "line"; delete t.cable; delete t["cable:type"]'],
['t.control_tower == "yes" && t.use == "air_traffic_control"','t["tower:type"] = "observation"'],
['t.crossing == "tank"','t.highway = "crossing"'],
['t.desert_surface','t.surface = t.desert_surface; delete t.desert_surface'],
Expand Down Expand Up @@ -1520,7 +1521,8 @@ tds70 = {
['t.natural == "wood"','t.landuse = "forest"; delete t.natural'],
['t.power == "pole"','t["cable:type"] = "power"; t["tower:shape"] = "pole"'],
['t.power == "tower"','t["cable:type"] = "power"; t.pylon = "yes"; delete t.power'],
['t.power == "line"','t["cable:type"] = "power"; t.cable = "yes"; delete t.power'],
['t.power == "line"','t["cable:type"] = "transmission"; t.cable = "yes"; delete t.power'],
['t.power == "minor_line"','t["cable:type"] = "power"; t.cable = "yes"; delete t.power'],
['t.rapids == "yes"','t.waterway = "rapids"; delete t.rapids'],
['t.railway == "station"','t.public_transport = "station"; t["transport:type"] = "railway"'],
['t.railway == "level_crossing"','t["transport:type"] = "railway";t["transport:type:2"] = "road"; a.F_CODE = "AQ062"; delete t.railway'],
Expand Down
15 changes: 12 additions & 3 deletions translations/tds71.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ tds71 = {

// print("##########");

// Yet Another lookup. FCODE and English name
// Used for O2S reasons
tds71.fcodeNameLookup = translate.makeFcodeNameLookup(tds71.rawSchema);
// print("tds71.fcodeNameLookup");
// translate.dumpLookup(tds71.fcodeNameLookup);
// print("##########");

// Decide if we are going to use TDS structure or 1 FCODE / File
// if we DON't want the new structure, just return the tds71.rawSchema
if (hoot.Settings.get('writer.thematic.structure') == 'false')
Expand Down Expand Up @@ -834,7 +841,8 @@ tds71 = {
['t.boundary == "protected_area" && !(t.protect_class)','t.protect_class = "4"'],
['t.bunker_type && !(t.military)','t.military = "bunker"'],
['t.defensive','t.man_made = "tower";t["tower:type"] = "defensive"'],
['t.cable =="yes" && t["cable:type"] == "power"',' t.power = "line"; delete t.cable; delete t["cable:type"]'],
['t.cable =="yes" && t["cable:type"] == "power"',' t.power = "minor_line"; delete t.cable; delete t["cable:type"]'],
['t.cable =="yes" && t["cable:type"] == "transmission"',' t.power = "line"; delete t.cable; delete t["cable:type"]'],
['t.control_tower == "yes" && t.use == "air_traffic_control"','t["tower:type"] = "observation"'],
['t.crossing == "tank"','t.highway = "crossing"'],
['t.desert_surface','t.surface = t.desert_surface; delete t.desert_surface'],
Expand Down Expand Up @@ -1494,7 +1502,8 @@ tds71 = {
['t.natural == "wood"','t.landuse = "forest"; delete t.natural'],
['t.power == "pole"','t["cable:type"] = "power"; t["tower:shape"] = "pole"'],
['t.power == "tower"','t["cable:type"] = "power"; t.pylon = "yes"; delete t.power'],
['t.power == "line"','t["cable:type"] = "power"; t.cable = "yes"; delete t.power'],
['t.power == "line"','t["cable:type"] = "transmission"; t.cable = "yes"; delete t.power'],
['t.power == "minor_line"','t["cable:type"] = "power"; t.cable = "yes"; delete t.power'],
['t.rapids == "yes"','t.waterway = "rapids"; delete t.rapids'],
['t.railway == "station"','t.public_transport = "station"; t["transport:type"] = "railway"'],
['t.railway == "level_crossing"','t["transport:type"] = "railway";t["transport:type:2"] = "road"; a.F_CODE = "AQ062"; delete t.railway'],
Expand Down Expand Up @@ -3176,7 +3185,7 @@ tds71 = {
}
else
{
tags.o2s_reason = geometryType + ' geometry is not valid for ' + attrs.F_CODE;
tags.o2s_reason = geometryType + ' geometry is not valid for ' + attrs.F_CODE + ' (' + tds71.fcodeNameLookup[attrs.F_CODE] + ')';
}

tableName = 'o2s_' + geometryType.toString().charAt(0);
Expand Down
6 changes: 0 additions & 6 deletions translations/tds71_rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -4667,12 +4667,6 @@ tds71.rules = {
['ZI004_RCG','39','attribution','mapping_service_(hungary)'], // Mapping Service (Hungary)
['ZI004_RCG','45','attribution','geospatial_intelligence_organisation_(new_zealand)'], // Geospatial Intelligence Organisation (New Zealand)

['ZSAX_RS0','U','security:classification','UNCLASSIFIED'],
['ZSAX_RS0','R','security:classification','RESTRICTED'],
['ZSAX_RS0','C','security:classification','CONFIDENTIAL'],
['ZSAX_RS0','S','security:classification','SECRET'],
['ZSAX_RS0','TS','security:classification','TOP_SECRET'],

// OTH Filler. These are to build OTH values
// ['RTY','999','highway','other'],

Expand Down
2 changes: 1 addition & 1 deletion translations/test/powerline.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('Power Lines', function () {

var tags = osmtogeojson(xml).features[0].properties;
assert.equal(tags[fcode_key], 'AT005');
assert.equal(tags['CAB'], '2');
assert.equal(tags['CAB'], '6');
assert.equal(tags['UFI'], 'd7cdbdfe-88c6-4d8a-979d-ad88cfc65ef1');

var osm_xml = server.handleInputs({osm: trans_xml, method: 'POST', translation: schema, path: '/translateFrom'});
Expand Down
8 changes: 4 additions & 4 deletions translations/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -1488,11 +1488,11 @@ translate = {
},


// makeLayerNameLookup - build a lookup table for FCODE to LayerName
makeFcodeList : function(schema)
// makeFcodeNameLookup - List of FCodes and their english name
makeFcodeNameLookup : function(schema)
{
var lookup = [];
schema.forEach( function (item) { if (lookup.indexOf(item.fcode) == -1) lookup.push(item.fcode); });
var lookup = {};
schema.forEach( function (item) { if (!lookup[item.fcode]) lookup[item.fcode] = item.desc; });
return lookup;
},

Expand Down