NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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


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;
}
permanent link

answered 11 Feb '23, 19:38

Fregiz's gravatar image

Fregiz
11113
accept rate: 0%

Follow this question

By Email:

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

By RSS:

Answers

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:

×483
×213
×147
×144
×30

question asked: 10 Feb '23, 07:49

question was seen: 1,301 times

last updated: 11 Feb '23, 19:38

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum