Way
Represents a single OSM feature with geometry and tags.
A Way is the fundamental unit of map data. It wraps an OSM way or
relation with its parsed geometry and tag dictionary, and provides
helpers to classify the feature.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
any
|
OSM way ID (positive integer) or a negative integer / string for manually annotated ways. |
is_area |
bool
|
|
nodes |
list
|
Ordered list of node IDs that make up this way. |
tags |
dict
|
OSM key-value tags (e.g. |
line |
BaseGeometry or None
|
Shapely geometry representing the way in UTM coordinates. |
in_out |
str
|
Direction hint used by some planners ( |
Attributes
Way objects are created by MapData.run_parse() and are not typically constructed manually.
| Attribute | Type | Description |
|---|---|---|
id |
int |
OSM way or relation ID |
nodes |
list |
Ordered list of OSM node IDs defining the geometry |
tags |
dict[str, str] |
OSM tags (e.g. {"highway": "footway", "surface": "asphalt"}) |
line |
shapely.Geometry \| None |
Geometry in UTM metres. LineString for roads and footways; Polygon for area-type barriers. None if unparsed. |
in_out |
str \| None |
Direction hint set by GraphPlanner: "in", "out", or None for bidirectional |
Note
The line geometry uses the same UTM coordinate system (metres) as the parent MapData
object. To convert a point to WGS84, use utm.to_latlon(x, y, md.zone_number, md.zone_letter).
Methods
map_data.utils.way.Way.is_road()
Return True if this way is a vehicle road (any highway value not in footway types).
map_data.utils.way.Way.is_footway()
Return True if this way is a pedestrian footway (highway in the footway value set).
map_data.utils.way.Way.is_barrier(yes_tags, not_tags, anti_tags)
Return True if this way should be classified as an untraversable barrier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
yes_tags
|
dict
|
Mapping of OSM tag key → list of values that indicate a barrier.
A |
required |
not_tags
|
dict
|
Exceptions to |
required |
anti_tags
|
dict
|
Tags that, if present, override a barrier match and return
|
required |