This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Getting road information from lat/lon in OSM

0

I am using osm database imported with osm2pgsql in slim mode. In my current app I have locations of different vehicles in lat lon. I want to get max speed, road name and road type for each location.

So here is the approach I am looking to implement

-- for each set of lat lon values find the closest point in planet_osm_points

-- find a node in planet_osm_nodes with lat and lon values equal to that of the point's multiplied with 100 (since lat lon in nodes is in integer form)

-- get the node id and find all ways in planet_osm_ways with these nodes and look for tags maxspeed and highway.

-- if max speed is not present use the maxspeed for that road type in that country.

So I have a few questions regarding this scenario

1- Is there a more optimized way of getting these values since I would be doing them for 1-2M records on a daily basis.

2- how can i find road name? which tag represents that?

3- Since I am doing all of this offline. is there any source from where I can get country wise max speed for roads programatically and dump it in my db?

Thanks

asked 25 Jul '17, 16:18

aitizazk's gravatar image

aitizazk
217710
accept rate: 0%

Source code available on GitHub .