3

I am looking for a robust way to determine if a geo point (long, lat) is located on a road

I am currently using openstreetmap overpass-api with the following query:

way[highway](around:3.0, {lat}, {lng});out;

And then I am looking for relevant values of "way" with "highway" from the following:

'motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential', 'service', 'tertiary_link', 'motorway_link', 'trunk_link', 'primary_link', 'secondary_link'

Yet I see that a 'road' is somehow not counted for its full width, but only its "middle spine", Here is an example of a grid with my classifier (Red means on a road, Green means not on a road):

enter image description here

I can estimate the road's width by its "lane" count, yet this is only an estimation, and not all roads has the "lane" tag.

What would be the best way to approach this problem?

  • My data is only relevant to the US
  • I can suffer some level of mistakes / errors
  • A batch / bulk solution is preferred

    EDIT:

The picture demonstrates the problem, I can only be close to the road's spine, and I cannot tell if I am on a road if I am far from the spine,

It would be great if I could get the full-road-polygon and query over it

3

I think this boils down to estimating the width of the streets:

https://stackoverflow.com/questions/25329738/how-to-get-the-osm-file-to-generate-width-of-the-streets#25330995

and then buffering the streets by their widths (actually half the street width either side of the centreline) and then doing a point-in-polygon operation or computing the point-line distance and thresholding by the half-width.

  • The probability of getting width/ lane tags on a "highway" object is low (<10%), so this leaves me with just the "highway" tag value, and the road spine, how can I derive a good solution out of it ? its too broad – Ron Ziv Jul 9 '18 at 13:36
  • 1
    You could take those 10% of roads that have a highway class and a width and fit a predictive model for road width given highway class? It all depends on how much tolerance for misclassifications you can bear. – Spacedman Jul 9 '18 at 15:18
  • Optimism. I just downloaded 2Mb of roads from San Fran, and of 3068 features only 1 had a width. 500 had non-missing "lanes". However most of the missing "lanes" were for service roads, footways, and residential which you can safely assume are one-way or two-way streets. – Spacedman Jul 9 '18 at 15:37
  • I went through this approach and the results are not bad, yet not good enough for my needs.I still wonder, isn't there better solutions ? no open source has roads as 2d polygon / actual roads boundaries / real roads widths ? – Ron Ziv Jul 10 '18 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.