pyrosm icon indicating copy to clipboard operation
pyrosm copied to clipboard

Check if user is on cyclelane/sidewalk

Open jugurthab opened this issue 3 years ago • 1 comments

Hi,

I'm new to OSM and pyrosm.

I'm wondering if it is possible to check if a given user is on a cyclelane, for example, I have the following data returned from the segment in which the user is located :

area None busway None cycleway lane highway secondary lanes 2 lit yes maxspeed 30 name Avenue Pierre Grenier oneway None ref D 101 service None sidewalk both surface asphalt id 385316748 timestamp 1613752335 version 5 tags {"parking:condition:left":"ticket","parking:co... osm_type way geometry (LINESTRING (2.25455 48.8342253, 2.2545737 48.... length 18

How can we check if a Bicycle is on Cyclelane (of course, we know the bicycle's geo position)?.

And how does the above output differs from : Cyclelane = None but in the tags Cyclaway:right = "share_busway"

Thanks.

jugurthab avatar Oct 13 '21 11:10 jugurthab

Hi @jugurthab!

The process for doing this would be something like:

  • get a cycling network with osm.get_network(network_type="cycling")
  • then you could e.g. do a small buffer around the roads (something like 5-20 meters?) and conduct a point in polygon check to estimate whether the GPS point is on a cyclelane (check e.g. these docs for inspiration)

Naturally the important thing to consider here is how you define a road that can be cycled? In many places, you also need to cycle on car roads. By default, pyrosm considers all roads bikeable which are not forbidden to cycle (e.g. motorways), but it depends on your use-case whether such assumption is okay or not.

HTenkanen avatar Oct 14 '21 18:10 HTenkanen