Class OsmLaneDefaults


  • public class OsmLaneDefaults
    extends Object
    Configure and retrieve the default configuration for the number of lanes for various osm way types (these are the total lanes on a link covering both directions. The "default" defaults for highway tags originate from https://wiki.openstreetmap.org/wiki/Key:lanes, while the "default" defaults for railways, i.e., the number of tracks is based on https://wiki.openstreetmap.org/wiki/Key:railway#Tracks. Waterways are given a single lane equivalent.
    Author:
    markr
    • Field Detail

      • defaultRoadLanesPerDirection

        protected static Map<String,​Integer> defaultRoadLanesPerDirection
        store the road based defaults
      • lanesPerDirection

        protected Map<String,​Integer> lanesPerDirection
        store the defaults for class instance
      • lanesPerDirectionIfUnspecified

        protected int lanesPerDirectionIfUnspecified
        lanes per direction if not configured
      • tracksPerDirectionIfUnspecified

        protected int tracksPerDirectionIfUnspecified
        railway tracks per direction if not configured
      • waterwayLanesPerDirectionIfUnspecified

        protected int waterwayLanesPerDirectionIfUnspecified
        water way lanes per direction if not configured
      • MINIMUM_LANES_PER_DIRECTION

        public static final int MINIMUM_LANES_PER_DIRECTION
        minimum number of lanes per direction, default is 1
        See Also:
        Constant Field Values
      • DEFAULT_LANES_PER_DIRECTION_IF_UNSPECIFIED

        public static final int DEFAULT_LANES_PER_DIRECTION_IF_UNSPECIFIED
        in case no mapping between highway type and number of lanes is present, use this. Default set to MINIMUM_LANES_PER_DIRECTION
        See Also:
        Constant Field Values
      • DEFAULT_TRACKS_PER_DIRECTION_IF_UNSPECIFIED

        public static final int DEFAULT_TRACKS_PER_DIRECTION_IF_UNSPECIFIED
        store the rail default. Default set to MINIMUM_LANES_PER_DIRECTION
        See Also:
        Constant Field Values
    • Constructor Detail

      • OsmLaneDefaults

        public OsmLaneDefaults()
        Constructor
      • OsmLaneDefaults

        public OsmLaneDefaults​(OsmLaneDefaults osmLaneDefaults)
        Copy constructor
        Parameters:
        osmLaneDefaults - to copy
    • Method Detail

      • populateDefaultLanesPerDirection

        protected static void populateDefaultLanesPerDirection()
        Initialise the defaults to use based on "common sense" as outlined in https://wiki.openstreetmap.org/wiki/Key:lanes
      • setDefaultDirectionalLanesByHighwayType

        public Integer setDefaultDirectionalLanesByHighwayType​(String type,
                                                               Integer defaultNumberOfLanesPerDirection)
        Overwrite current default
        Parameters:
        type - highway type
        defaultNumberOfLanesPerDirection - the new default
        Returns:
        old value if any, null if not present
      • getDefaultDirectionalLanesByHighwayType

        public Integer getDefaultDirectionalLanesByHighwayType​(String osmWayValue)
        collect the number of lanes based on the highway type, e.g. highway=type, for any direction (not total). In case no number of lanes is specified for the type, we revert to the missing default
        Parameters:
        osmWayValue - highway type value
        Returns:
        number of lanes for this type (if any), otherwise null is returned
      • setDefaultDirectionalRailwayTracks

        public void setDefaultDirectionalRailwayTracks​(Integer defaultNumberOfTracksPerDirection)
        Overwrite current default
        Parameters:
        defaultNumberOfTracksPerDirection - the new default
      • getDefaultDirectionalRailwayTracks

        public Integer getDefaultDirectionalRailwayTracks()
        Collect the default number of tracks for railways (in one direction)
        Returns:
        defaultNumberOfTracksPerDirection in case not explicitly specified
      • getDefaultDirectionalWaterwayLanes

        public Integer getDefaultDirectionalWaterwayLanes()
        Collect the default number of water way lanes for water ways (in one direction)
        Returns:
        waterwayLanesPerDirectionIfUnspecified in case not explicitly specified
      • getDefaultDirectionalLanesByWayType

        public Integer getDefaultDirectionalLanesByWayType​(String osmKey,
                                                           String osmValue)
        collect the number of lanes based on the highway type, e.g. highway=type, for any direction (not total). In case no number of lanes is specified for the type, we revert to the missing default
        Parameters:
        osmKey - OSM key to identify the way type (highway, rail way, or water way)
        osmValue - OSM key's value
        Returns:
        number of lanes for this type (if any), otherwise null is returned
      • getDefaultTotalLanesByHighwayType

        public Integer getDefaultTotalLanesByHighwayType​(String type)
        collect the number of lanes based on the highway type, e.g. highway=type, in total (both directions)
        Parameters:
        type - highway type value
        Returns:
        number of lanes for this type (if any), otherwise null is returned
      • shallowClone

        public OsmLaneDefaults shallowClone()
        Shallow copy
        Returns:
        shallow copy