Skip to main content

Guesstimate properties like street width in incomplete openstreetmap (osm) data.

osm_guesstimator uses tag combinations to figure out a best guess for missing values. In the example of street width, the width=* value is used, interpreting a wide range of non-standard notations for this key. If the width value is either missing or cannot be parsed as a valid value, a combination of highway type and, if available, lane count, is used to get a best guess.

installation

pip install osm-guesstimator 

Requires Python 3.6 or higher.

usage

So far, the only function implemented is estimatewaywidth. It takes the highway as a geojson object, for example:

highway = {
  "type": "way",
  "id": 1351793418,
  "nodes": [
    65295447,
    12246845964,
    65356292,
    12246845963,
    3978836027,
    5431134833
  ],
  "tags": {
    "cycleway:both": "no",
    "highway": "residential",
    "lit": "yes",
    "name": "11th Avenue",
    "parking:lane:both": "parallel",
    "parking:lane:both:parallel": "on_street",
    "sidewalk": "both",
    "surface": "asphalt",
    "tiger:cfcc": "A41",
    "tiger:county": "San Francisco, CA",
    "tiger:name_base": "11th",
    "tiger:name_type": "Ave"
  }
}

You can call it like this:

import osm_guesstimator

estimated_width = estimatewaywidth(highway)

print(estimated_width)

The estimated width is a float value in meters, rounded to two decimal places to allow for centimeter precision.

Currently, these highway=* values are supported: 'bridleway', 'busway', 'bus_guideway', 'corridor', 'cycleway', 'escape', 'footway', 'living_street', 'motorway', 'motorway_link', 'path', 'pedestrian', 'primary', 'primary_link', 'raceway', 'residential', 'road', 'secondary', 'secondary_link', 'service', 'steps', 'tertiary', 'tertiary_link', 'track', 'trunk', 'trunk_link', 'unclassified'. Any other highway tag value, including missing highway tags, will result in an exception.

statistics

The value estimation is based on existing data on osm. The following graph shows the width distribution of highway objects with (parseable) width data, by highway type and lane count. The lane coun was differenciated into values between 1 and 8 and anything else, where anything else includes missing lane number info as well as any values other than numbers between 1 and 8.

![[Width distribution by highway type.png]] Sorting any lane values that are not numbers between 1 and 8 as unspecified excludes both highways with lane numbers higher than 8 and highways with lane numbers in non standard notation. However, this is deemed good enough, as 99.94% of lane values are accounted for.

For each combination of highway type and lane count, including unspecified, a median width is determined that is applied to highways that don't have a (parseable) width value themselves as a best guess.

A third dimension to differenciate highway width in, aside from highway type and lane count, is the subtype, especially in highway=service features. The following graph shows the service road width distribution by service road type. However, this consideration in the width estimation is not yet implemented.

![[Service Road width distribution by type.png]]

contribute

For feature requests or bugfixes, github issues or pull requests are always welcome.

You can also have a look at the proposals section to find projects to work on.

Finally, you can go out and map! I will regularly download the newest osm data and update the median values accordingly. Therefore, measuring and mapping the world around you or fixing typos and other non standard tagging in the data set will increase the accuracy of the estimations.

‼️ DO NOT USE THIS TOOL TO INPUT DATA INTO OSM ‼️ The estimation functions only produces rough estimates and the resulsts are therefore not reliable. They are good enough for most cases, especially when manually measuring on a large number of objects is not feasible, but it does not warrant the level of trust people have in the data on osm. It would also lead to an effect where inaccuracies and biases of this method would procreate and intensify as the function would feed itself the map data created by itself.

proposals

Some proposals for futre extensions include:

  • Supporting ranges in data (for example, a width of "2m ~ 3m").
  • Supporting other object types
    • Building height based on the building type and number of floors
    • Height and crown diameter of trees based on species and other factors
    • Waterway widths based on waterway type
  • Take regional differences into account: Adjust the data to include rough locations, form lists of typical values for each region as an additional dimension for the estimations
  • Take service road type into account

Metadata

Release files for osm-guesstimator 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for osm-guesstimator 0.1
File Size Uploaded Provenance Actions
osm_guesstimator-0.1.tar.gz 608.7 kB Without provenance Details for osm_guesstimator-0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for osm-guesstimator 0.1
File Interpreter ABI Platform Actions
osm_guesstimator-0.1-py3-none-any.whl Python 3 none any Details for osm_guesstimator-0.1-py3-none-any.whl

Total release size: 614.2 kB

Release files / osm_guesstimator-0.1.tar.gz

Download URL osm_guesstimator-0.1.tar.gz
Size 608.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c94e1561957ce9256b69aa0082501754929c84998071fedde53c9d60a60d4098
BLAKE2b-256 checksum
How to use checksums
0760431e3f3c1b9c62c1abc31785220d7b6a05bc7b12293c0ec9958198a7aa29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Release files / osm_guesstimator-0.1-py3-none-any.whl

Download URL osm_guesstimator-0.1-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9caba25a4d534bf9f5a4b5939d43dd0780ba56a0b51a3faee8b34445f49da163
BLAKE2b-256 checksum
How to use checksums
7aa2a807d227db7d71d5acf258b0fdd2ff26279c9b591d85c24754f9b3353a90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Security for osm-guesstimator 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page