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

I have a query that works alright in Overpass Turbo, which I can't run directly by sending it with curl (it says "Your browser sent a request that this server could not understand."). As far as I can tell it's not using Overpass Turbo's extended syntax.

The query is meant to get the buildings, shops etc, and adjoining streets, along a street.

Here is the query that works only in Overpass Turbo:

area[name="Bratislava"];
way(area)[name="Štúrova"]->.my_street;
(
        nw[amenity](around.my_street:25);
        nwr[building](around.my_street:25);
        wr[highway](around.my_street:25);
);
(._;>;);
out;

and here is the biggest piece of it that I have been able to get working with curl --- it has only one of the original three parts of the "union" construct:

area[name="Bratislava"];
way[name="Štúrova"]->.my_street;
(node[amenity](around.my_street:25););
(._;>;);
out;

Also, I tried some other subsets of the original query, and they ran for a relatively long time and I killed them to avoid excessive server use; the whole thing runs in about 18 seconds under Overpass Turbo.

How can I get this to work under curl (eventually, I will be using it from ClojureScript in a client-side app)?

asked 09 Feb '22, 12:55

HillWithSmallFields's gravatar image

HillWithSmal...
31114
accept rate: 0%

1

Can you show us how you tried to run the curl command? I have a hunch you might have a problem with quoting on the shell command line.

(09 Feb '22, 12:58) Frederik Ramm ♦

Thanks, but I don't think that'll be it. I'm using the command line:

curl --output r1 --get --data @q1 https://overpass-api.de/api/interpreter

and the contents of the file q1 are as follows:

[out:json][timeout:25];
area[name="Bratislava"];
way(area)[name="Štúrova"]->.my_street;
(
        nw[amenity](around.my_street:25);
        nwr[building](around.my_street:25);
        wr[highway](around.my_street:25);
);
(._;>;);
out;
(09 Feb '22, 15:53) HillWithSmal...

As a side note, if I remember correctly, killing curl won't stop the request on the server, so you might as well wait for the result.

(09 Feb '22, 18:37) H_mlet

I hadn't realized that, thanks. Now I've got the query working with curl, it's taking the same length of time as it does on Overpass Turbo, so there may have been something wrong in the ones that were taking longer.

(09 Feb '22, 18:52) HillWithSmal...

Remove all indentation whitespace from q1.

PS Unsure if --get is essential. I think it's the default action.

permanent link

answered 09 Feb '22, 16:24

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

edited 09 Feb '22, 16:36

Thanks --- that fixed it!

I guess Overpass Turbo must be doing that for me.

(09 Feb '22, 16:28) HillWithSmal...
1

According to the manual page on debian, POST is the default action if --data is given.

(09 Feb '22, 18:46) HillWithSmal...

Could you test something? I added the indents back in & it ran. what results do you get?

(13 Feb '22, 20:52) DaveF
Your answer
toggle preview

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:

×54

question asked: 09 Feb '22, 12:55

question was seen: 2,537 times

last updated: 13 Feb '22, 20:52

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