Question

I have some trouble getting the query right to get information about a road an users is on at a given moment.

For example the user is driving a car and I want to get some information about the road the user is driving on every now and then.

I tried to use the coord-query to get location specific information, but I couldn't find any useful information.

<?xml version="1.0" encoding="UTF-8"?>
<osm-script>
   <coord-query lat="51.87810" lon="4.52587" />
   <print mode="body" />
</osm-script>

However when I try to run a bbox-query:

<query type="way">
  <has-kv k="maxspeed"/>
  <bbox-query {{bbox}}/>
</query>
<union>
  <item/>
  <recurse type="down"/>
</union>
<print/>

I get a lot more useful information as a response such as name, oneway, bicycles allowed etc.

I am using this tool to test the queries.

My question is how I can achieve to get the information from the bbox-query out of a coord-query, so it will return only information about that specific location instead of also information about the streets around it?

Was it helpful?

Solution

Unfortunately there is no much documentation for the coord-query and no examples but it looks like this query is for searching areas and not ways.

In my opinion a bbox-query might be more useful because you never have exact coordinates. Also keep in mind that at a particular coordinate there can be more than just one road, e.g. at intersections or roads passing above/under each other or being very close together.

So either way you will have to implement something for comparing several roads in order to decide which one is the most plausible one. This can be done for example by looking where you have been and where you area heading to and by comparing this information with the geometry of the surrounding roads. Likewise the first and last nodes of an OSM way will help you because connected ways always share the same nodes at the start or end.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top