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

Nominatim - returning road type to figure out max road speed

0

I'm using nominatim to get max road speed

If the data is not present (only around 10% is), I can guess the roadspeed based on road type

i.e. in the UK, if its a residential road, it will be 30mph, and if its a motorway it will be 70mph

However the data returned does not indicate the road type, I get a OSM_TYPE of WAY, but that's it.

Is the above possible? if so how can i alter my call to return this info?

asked 08 Oct '18, 08:22

Mark%20Davies1664's gravatar image

Mark Davies1664
31334
accept rate: 0%

edited 08 Oct '18, 08:23

2

Nominatim seems like an odd choice to get max road speed?

(08 Oct '18, 08:58) SomeoneElse ♦
1

Can you give an example query that does not tell you the road type when you expected it to do so?

(08 Oct '18, 08:59) Frederik Ramm ♦

I'm using it to get the road name and roadspeed as one call Here is an example of one

{"place_id":"70381573","licence":"Data © OpenStreetMap contributors, ODbL 1.0. https:\/\/osm.org\/copyright", "osm_type":"way", "osm_id":"4968823", "lat":"51.51465608749", "lon":"-3.1915241864833", "display_name":"Heathwood Road, Heath, Cardiff, Wales, CF, UK","address": {"road":"Heathwood Road", "suburb":"Heath", "city":"Cardiff", "county":"Cardiff", "state":"Wales", "postcode":"CF", "country":"UK", "country_code":"gb"}, "extratags":{"foot":"yes", "lanes":"2", "oneway":"no", "surface":"asphalt", "maxspeed":"30 mph"}, "boundingbox":["51.5115152","51.516782","-3.1997308","-3.1860733"]}

(08 Oct '18, 09:25) Mark Davies1664
1

Which query led to this result - did you do a "search.php?q=Heathwood Road, Cardiff" or rather a "reverse.php?lat=51.514656&lon=-3.191524" or...? Please specify exact URL as it might be relevant for finding the problem.

(08 Oct '18, 09:37) Frederik Ramm ♦

One Answer:

1

Building up on what Frederik said. Use format=jsonv2, then you'll see a field 'category' and 'type'. Example https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=51.51465608749&lon=-3.1915241864833&zoom=18&addressdetails=1&extratags=1 shows 'category=highway', 'type=tertiary' which is equivalent to 'highway=tertiary' in https://www.openstreetmap.org/way/4968823

Same for forward search https://nominatim.openstreetmap.org/search?format=jsonv2&q=Heathwood%20Road,%20Cardiff&addressdetails=1&extratags=1

answered 08 Oct '18, 12:44

mtmail's gravatar image

mtmail
4.8k1574
accept rate: 27%

great thanks So in the UK i can assume tertiary and residential are both 30mph, and highway is 70mph

I guess primary, secondary etc are a bit harder to classify so i can leave these as unknown ?

(08 Oct '18, 13:57) Mark Davies1664

Probably. And there might be limits if it's inside or outside a city boundary. maxspeed is complex https://wiki.openstreetmap.org/wiki/Talk:Key:maxspeed and I'd check if there was previous discussion on https://lists.openstreetmap.org/listinfo/talk-gb (or start a new one)

(08 Oct '18, 15:22) mtmail

Source code available on GitHub .