Hi everyone,

today we announce a new feature for our geocoding - the ability to get speed limits and other road information!

This new feature has a few pieces:

First of all, by default all requests now have a new roadinfo annotation (see full docs)

In the most basic case this annotation has the following keys:

  • drive_on with value of right or left depending on which side of the road they drive on in that country/territory

  • speed_in with possible values km/h or mph to show the units speed limits are typically listed in that country/territory.

As an aside, yes, it is odd that the official abbreviations for miles per hour (mph) and kilometers per hour (km/h) are not formatted the same way.

Secondly, if the geocoding result was a road we also return various fields about the road:

  • road

  • road_type

  • road_reference

  • road_reference_intl

These fields and values also appear in the components portion of the response, but we repeat them here as a convenience so all the road information is in one place. Of course not every road has a reference and most don’t have an international reference.

Finally, there is now also a new optional roadinfo parameter that can be set in your request to the geocoder. When set, the behaviour of the geocoder changes: rather than trying to return the most precise answers we can, typically an address, we now try to match to the nearest road.

If possible we then return the following additional information in the `roadinfo’ annotation:

  • lanes

  • maxspeed

  • oneway

  • surface

  • toll (set only if the road is a toll road)

  • width

The various values for these fields are documented in detail on our API docs, but it’s important that I emphasize a few points:

First, this is crowd-sourced data from open sources like OpenStreetMap, it is not “official” governmental data. So it may not be complete - though anyone who has ever dealt with “official” data also knows it is rarely complete. But more importanlty from a safety perspective is that speed limits are actually very complex and can depend on factors like weather, time of year, time of day, type of vehicle, and many other factors, so it should be taken as a reference only. Always obey the marked speed limit.

Second, annotations can be turned off by using the optional no_annotations=1 parameter, and we recommend you do that if you don’t need the information in the annotations as it means we can respond to your query a tiny bit faster. Nevertheless, if you supply the optional roadinfo=1 parameter with your request, we will return the roadinfo annotation, regardess of whether you have set no_annotations or not.

Visit the documentation to learn more about getting road/driving information from the OpenCage Geocoding API.

Happy vehicle tracking,

Ed

written from near

    "annotations" : {
            "roadinfo" : {
               "drive_on" : "right",
               "oneway" : "yes",
               "road" : "Carrer de Calatrava",
               "road_type" : "residential",
               "speed_in" : "km/h"
            }
         },

Final thing - want to impress your friends with some geo road information trivia? Can you name the British territory where they drive on the right side of the road? What about the US territory where they drive on the left side of the road? Feel free to get in touch if you want the answers.