I'm currently working on a project which involves tracing the path(GPS coordinates) taken by a vehicle (1) and measuring the traffic conditions(is it jammed and whats the speed during the time the vehicle was there) along the path in which the driver took (2). This is to judge whether the driver had made the appropriate actions to drive environmentally friendly and fuel efficiently during his time on route.

Therefore i need 2 things.

(1) A Way to Uniquely identify each road based on their direction it heads towards ( 2 or more for each road) I understand that there are OpenStreetMaps- WAY which provides me a set of nodes which will identify a road with a unique id however i am currently struggling to find the API service which can provide it to me.

(2) Any traffic APi reccomendation that can provide me with historical traffic data which i can use.


asked 03 Jun '15, 12:14

DillyDallyKing's gravatar image

accept rate: 0%

about (1): Maybe you need something like geocoding? then see http://wiki.openstreetmap.org/wiki/Search_engines ...

or about the most used OSM APIs: http://wiki.openstreetmap.org/wiki/Xapi

or (even better!): http://wiki.openstreetmap.org/wiki/Overpass_API

(03 Jun '15, 16:41) stephan75

For this task I suggest to use the map matching project (where I'm the author of)

With this project you can easily associate arbitrary GPS coordinates to edge IDs of GraphHopper. An edge is the connection between two junctions. And then you can use this to influence the routing of GraphHopper itself. I've blogged about the map matching here and also about the traffic influenced routing here. The problem you'll encounter is that you can get the edge IDs but not the OSM IDs and you'll have to take care when you re-import the data with fresh OSM data where the edge IDs will change. But as I've already done this several times I can say there are ways to make it working ;)

For the second part of your question I only have a partial answer. We've started to collect some open/free data sources here where often e.g. only the traffic counts is available (not the flow or speed of the vehicles). Feel free to add your known sources and maybe make this more popular so that more people add their sources ;)

permanent link

answered 06 Jun '15, 18:54

peatar's gravatar image

accept rate: 8%

edited 06 Jun '15, 18:56

There is currently an open project well underway to define both an API and a matching algorithm based on OSM data here: https://github.com/opentraffic they use an approach based on osm ID and way start/end coordinates.

permanent link

answered 07 Jun '15, 16:10

SimonPoole's gravatar image

SimonPoole ♦
accept rate: 19%

For (1) (identifying roads), it depends on how you want to process the data. if you were to import OSM data into a PostGIS database with osm2pgsql, then you can look at the osm_id column to determine the OSM id of the underlying way object. However, OSM can, and does, split ways when a tag changes, so "one street"/"one road" can be represented as many different ways in OSM.

It's also possible for an OSM object to be deleted and replaced by a mapper, meaning the old id would no longer be valid and there'd be a new id.

permanent link

answered 08 Jun '15, 13:24

rorym's gravatar image

accept rate: 11%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 03 Jun '15, 12:14

question was seen: 4,418 times

last updated: 08 Jun '15, 13:24

powered by OSQA