[GIS] How to run an extended overpass turbo query from a script

openstreetmapoverpass-api

I have an xml query which starts out like this:

<osm-script output="xml" timeout="250">
  <id-query {{nominatimArea:Ridgefield Connecticut}} into="area"/>
  <!-- gather results -->
  <union>

This works fine here: http://overpass-turbo.eu/s/5J7

But when I try to query using wget, it returns HTTP request sent, awaiting response... 400 Bad Request. If I resolve the query into it normalized form, then it works fine:

<osm-script output="xml" timeout="250">
  <id-query type="area" ref="2705805056" into="area"/>
  <!-- gather results -->
  <union>

How can I pass the former query through a script, or how can I lookup the area in advance?

Best Answer

Look at the official website for more to correctly use WGET http://overpass-api.de/command_line.html

You can also to get started, try with CURL instead of WGET: it's more easy as you can copy the call you do in browser using the Network panel of your debugger (below illustrated with Google Chrome but available also on FireFox)

Google Chrome CURL copy with OverPass API

For scripting, this query Overpass Python library or this Node JS package can be interesting.