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

Overpass: Gather information on ways for a given area passing coordinates to query

0

Hello, I am new to OSM. So I apologize if my question is trivial. I would like to gather lenghts of ways in a given rectangle.

I am able to search for given area name (for instance Bonn) and it works:

[out:csv(length,value)];
area[name="Bonn"]->.a;
area[name="Bonn"]->.b;
way[highway](area.a)(area.b);
for (t["highway"])
{
  make stat value=_.val,length=sum(length());
  out;
}

But now I would like to to it for a given rectangle (passing coordinates). I tried with this but it does not work:

[out:csv(length,value)];
[bbox:50.6,7.0,50.8,7.3]->.a;
way[highway](area.a);
for (t["highway"])
{
  make stat value=_.val,length=sum(length());
  out;
}

And even in this way I still get errors:

[out:csv(length,value)];
[bbox:50.6,7.0,50.8,7.3];
way[highway]({{bbox}});
for (t["highway"])
{
  make stat value=_.val,length=sum(length());
  out;
}

Could you help me fix this?

Thanks a lot!

asked 10 Feb '23, 07:49

Fregiz's gravatar image

Fregiz
11113
accept rate: 0%

edited 10 Feb '23, 07:52


One Answer:

0

It was as simple as that:

[out:csv(length,value)];
way[highway](50.6,7.0,50.8,7.3);
for (t["highway"])
{
  make stat value=_.val,length=sum(length());
  out;
}

answered 11 Feb '23, 19:38

Fregiz's gravatar image

Fregiz
11113
accept rate: 0%

Source code available on GitHub .