Guesstimate properties like street width in incomplete osm data
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file osm_guesstimator-0.1.tar.gz.
File metadata
- Download URL: osm_guesstimator-0.1.tar.gz
- Upload date:
- Size: 608.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c94e1561957ce9256b69aa0082501754929c84998071fedde53c9d60a60d4098
|
|
| MD5 |
f08f54bf902a64173f378bb36ac1abe5
|
|
| BLAKE2b-256 |
0760431e3f3c1b9c62c1abc31785220d7b6a05bc7b12293c0ec9958198a7aa29
|
File details
Details for the file osm_guesstimator-0.1-py3-none-any.whl.
File metadata
- Download URL: osm_guesstimator-0.1-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9caba25a4d534bf9f5a4b5939d43dd0780ba56a0b51a3faee8b34445f49da163
|
|
| MD5 |
072e287049d222ad0cf8eff33817b54d
|
|
| BLAKE2b-256 |
7aa2a807d227db7d71d5acf258b0fdd2ff26279c9b591d85c24754f9b3353a90
|