Please I need help. See the code below:

query = "way(%s, %s, %s, %s);(._;>;);out geom;" % ( lat_min, lon_min, lat_max, lon_max )["highway"="footway"]


My name is to use the four coordinates (lat_min, lon_min, lat_max, lon_max )to create a rectangular boundary for extracting particular highway information (e.g. footway), but I kept getting error on the syntax.

Please what are am i doing wrongly?

asked 17 Feb, 15:11

Segunlakata's gravatar image

accept rate: 0%

edited 17 Feb, 16:56

alester's gravatar image



I think you need to provide more information "%s" is not overpass syntax so I presume you are building queries in something like php or python. Can you capture an example of the generated query & show that instead?

(17 Feb, 15:32) SK53 ♦

Supplementary information has been provided in a closed question here:

(18 Feb, 08:43) InsertUser

I don't know python, but...

If you're making one call:

out geom;

If you need a global bbox for multiple calls


If you want to define a multi-sided polygon:

way(poly:"51.4591971 -0.9723236 51.7053402 -0.6110287 51.6639446 -0.3961114")[highway=unclassified];
out geom;

PS When you next post a question can you provide a routine which doesn't return empty. It makes it hard to determine any errors.

permanent link

answered 17 Feb, 20:39

DaveF's gravatar image

accept rate: 14%

Yes, I am using python. I wrote use this code below and it is working fine for me.

import overpy
import json
from copy import deepcopy
import haversine as hs
import math

api = overpy.Overpass()
#generate an intended map boundary for a given coordinates

result = api.query (f'way(around:100,49.8974309,-97.2033944 )["highway"="footway"];(._;>;);out geom;')

where, radius=100m latitude =49.8974309 longitude=-97.2033944

But now, i do not want to use radius again, rather i want to use four coordinates like a rectangular bounding box to query osm for highway (e.g. footway in particular, in the specified area) using python.

permanent link

answered 17 Feb, 16:06

Segunlakata's gravatar image

accept rate: 0%

edited 17 Feb, 16:55

alester's gravatar image


Your answer
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 17 Feb, 15:11

question was seen: 318 times

last updated: 18 Feb, 08:43

powered by OSQA