[GIS] Get road type by coordinates

google-maps-apiopenstreetmapreverse-geocoding

I need to do the following task: to retrieve the road type (highway, bridge, track, pedestrian and others) by coordinates, query a remote service (via HTTP).

I'm looking at the different major solutions available on the web (OpenStreetMap, Google Maps, Bing Maps, HERE Maps, Apple Maps), trying to compare them to better identify their limitations, but I need help completing this list.

At the moment, I just scouted OpenStreetMap service:
using OverpassAPI or a 2-queries method: using Nominatim + XAPI

What about the other services?

Google Maps: ???
Bing Maps: ???
HERE Maps: ???
Apple Maps: ???

Best Answer

It probably depend on what you want to do with these informations and on the number of points on which you want apply this.

1) If you have not many points you can maybe try to do this with the overpass API. Trying to get the closest road around your pair of coordinates. It might look like this :

[out:json];
way["highway"~"."](around:5,50.7528080,2.0377858);
out geom;

You can take a small radius (like 1) and increasing it if you dont have result. Depending on what you want to do with your data, but this should provide you the infos you want (if you dont need geometry you can use out; instead of out geom;). It might be useful to have some basics in a scripting language to make the queries (increasing the radius if no result, etc.) and to process the data retrieved (or/and you can use a library like overpy which provide python bindings for the overpass API).

2) If you have many points, maybe you can have a look on the photon project, it's a geocoder based on elasticsearch and nominatim. I think you can make a reverse geocoding request and get the road type (at least the value for the key "highway" and the corresping osm id) with a local instance of this geocoder. The reverse API is not really documented on the main page but here.

Hope that it can help you.