Apologies if this is a dense question I am green with OSM.

When I make an API bounding box call like below:

import overpass

# bounding box coordinates
min_long = min(longs)
min_lat = min(lats)
max_long = max(longs)
max_lat = max(lats)

# query overpass within OpenStreetMap
api = overpass.API()
map_query = overpass.MapQuery(min_lat,min_long,max_lat,max_long)
response = api.Get(map_query)

The output is not wrapped in a Python dictionary like here. The response appears to be xml.

Anybody have an idea of what is going on here? Thanks in advance!

asked 16 Feb '16, 16:46

jlgutenson's gravatar image

accept rate: 0%

Turns out the pip installation of the Python Overpass API is different than the current version on github. If anyone else encounters this problem, just install the github version instead.

permanent link

answered 16 Feb '16, 19:29

jlgutenson's gravatar image

accept rate: 0%

Overpass API supports different file formats (currently XML, JSON and CSV). According to a quick search you seem to be using Overpass API python wrapper. The README explains that you can call Get() with a responseformat parameter for choosing the file format. So try calling api.Get(map_query, responseformat="json").

permanent link

answered 16 Feb '16, 16:55

scai's gravatar image

scai ♦
accept rate: 23%

I've seen that. Interestingly though, I keep getting the error TypeError: Get() got an unexpected keyword argument 'responseformat' for any format type.

(16 Feb '16, 18:16) jlgutenson

I just tried the example from the README with the latest version on GitHub and it works. It even uses "geojson" as default file format. But specifying responseformat="json" or responseformat="xml" also works fine.

(16 Feb '16, 18:26) scai ♦

Interesting @scai, are you using version 0.3.1 as well? Sounds like something with my installation is off.:-/

(16 Feb '16, 18:34) jlgutenson

I'm using the master branch which seems to be 0.3.1 according to __init__.py.

(16 Feb '16, 18:35) scai ♦
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](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:


question asked: 16 Feb '16, 16:46

question was seen: 3,477 times

last updated: 16 Feb '16, 19:29

powered by OSQA