mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-01 04:31:36 +02:00
validate crossing aeroways (#9315)
This commit is contained in:
committed by
Martin Raifer
parent
a2e347ac97
commit
f244e63661
@@ -233,6 +233,10 @@ export var osmRoutableHighwayTagValues = {
|
||||
unclassified: true, road: true, service: true, track: true, living_street: true, bus_guideway: true, busway: true,
|
||||
path: true, footway: true, cycleway: true, bridleway: true, pedestrian: true, corridor: true, steps: true, ladder: true
|
||||
};
|
||||
/** aeroway tags that are treated as routable for aircraft */
|
||||
export const osmRoutableAerowayTags = {
|
||||
runway: true, taxiway: true
|
||||
};
|
||||
// "highway" tag values that generally do not allow motor vehicles
|
||||
export var osmPathHighwayTagValues = {
|
||||
path: true, footway: true, cycleway: true, bridleway: true, pedestrian: true, corridor: true, steps: true, ladder: true
|
||||
|
||||
@@ -8,7 +8,7 @@ import { modeSelect } from '../modes/select';
|
||||
import { geoAngle, geoExtent, geoLatToMeters, geoLonToMeters, geoLineIntersection,
|
||||
geoSphericalClosestNode, geoSphericalDistance, geoVecAngle, geoVecLength, geoMetersToLat, geoMetersToLon } from '../geo';
|
||||
import { osmNode } from '../osm/node';
|
||||
import { osmFlowingWaterwayTagValues, osmPathHighwayTagValues, osmRailwayTrackTagValues, osmRoutableHighwayTagValues } from '../osm/tags';
|
||||
import { osmFlowingWaterwayTagValues, osmPathHighwayTagValues, osmRailwayTrackTagValues, osmRoutableAerowayTags, osmRoutableHighwayTagValues } from '../osm/tags';
|
||||
import { t } from '../core/localizer';
|
||||
import { utilDisplayLabel } from '../util/utilDisplayLabel';
|
||||
import { validationIssue, validationIssueFix } from '../core/validation';
|
||||
@@ -44,7 +44,7 @@ export function validationCrossingWays(context) {
|
||||
}
|
||||
|
||||
function allowsBridge(featureType) {
|
||||
return featureType === 'highway' || featureType === 'railway' || featureType === 'waterway';
|
||||
return featureType === 'highway' || featureType === 'railway' || featureType === 'waterway' || featureType === 'aeroway';
|
||||
}
|
||||
function allowsTunnel(featureType) {
|
||||
return featureType === 'highway' || featureType === 'railway' || featureType === 'waterway';
|
||||
@@ -63,6 +63,8 @@ export function validationCrossingWays(context) {
|
||||
|
||||
var tags = entity.tags;
|
||||
|
||||
if (tags.aeroway in osmRoutableAerowayTags) return 'aeroway';
|
||||
|
||||
if (hasTag(tags, 'building') && !ignoredBuildings[tags.building]) return 'building';
|
||||
if (hasTag(tags, 'highway') && osmRoutableHighwayTagValues[tags.highway]) return 'highway';
|
||||
|
||||
@@ -126,6 +128,9 @@ export function validationCrossingWays(context) {
|
||||
primary: true, primary_link: true, secondary: true, secondary_link: true
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {object | null} the tags for the connecting node, or null if the entities should not be joined
|
||||
*/
|
||||
function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) {
|
||||
var featureType1 = getFeatureType(entity1, graph);
|
||||
var featureType2 = getFeatureType(entity2, graph);
|
||||
@@ -134,6 +139,27 @@ export function validationCrossingWays(context) {
|
||||
var geometry2 = entity2.geometry(graph);
|
||||
var bothLines = geometry1 === 'line' && geometry2 === 'line';
|
||||
|
||||
/**
|
||||
* @typedef {NonNullable<ReturnType<getFeatureType>>} FeatureType
|
||||
* @type {`${FeatureType}-${FeatureType}`}
|
||||
*/
|
||||
const featureTypes = [featureType1, featureType2].sort().join('-');
|
||||
|
||||
if (featureTypes === 'aeroway-aeroway') return {};
|
||||
|
||||
if (featureTypes === 'aeroway-highway') {
|
||||
const isServiceRoad = entity1.tags.highway === 'service' || entity2.tags.highway === 'service';
|
||||
const isPath = entity1.tags.highway in osmPathHighwayTagValues || entity2.tags.highway in osmPathHighwayTagValues;
|
||||
// only significant roads get the aeroway=aircraft_crossing tag
|
||||
return isServiceRoad || isPath ? {} : { aeroway: 'aircraft_crossing' };
|
||||
}
|
||||
|
||||
if (featureTypes === 'aeroway-railway') {
|
||||
return { aeroway: 'aircraft_crossing', railway: 'level_crossing' };
|
||||
}
|
||||
|
||||
if (featureTypes === 'aeroway-waterway') return null;
|
||||
|
||||
if (featureType1 === featureType2) {
|
||||
if (featureType1 === 'highway') {
|
||||
var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
|
||||
@@ -167,7 +193,6 @@ export function validationCrossingWays(context) {
|
||||
if (featureType1 === 'railway') return {};
|
||||
|
||||
} else {
|
||||
var featureTypes = [featureType1, featureType2];
|
||||
if (featureTypes.indexOf('highway') !== -1) {
|
||||
if (featureTypes.indexOf('railway') !== -1) {
|
||||
if (!bothLines) return {};
|
||||
|
||||
Reference in New Issue
Block a user