Why not ask your question on the new OpenStreetMap Community Forum?

I'm trying to get the center point with Python and overpy:

api = overpy.Overpass()
result = api.query("""way(381501602);out center;""")

but unlike to Overpass Turbo, where I get the center point 49.2559306 / 8.4525152 overpy just returns all nodes:

result.nodes is empty and result.ways contains

< overpy.Way id=381501602 nodes=[2338081031, ...]>

asked 07 Oct '17, 17:19

Druzhba's gravatar image

accept rate: 0%

Overpass appends a center element to the way:

<?xml version="1.0" encoding="UTF-8"?> <osm version="0.6" generator="Overpass API"> <note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note> <meta osm_base="2017-10-07T18:59:02Z"/> <way id="381501602"> <center lat="49.2559306" lon="8.4525152"/> <nd ref="2338081031"/> <nd ref="2338081030"/>

You'll have to see if overpy supports this element or not. It seems to: https://python-overpy.readthedocs.io/en/latest/api.html#elements

permanent link

answered 07 Oct '17, 20:08

maxerickson's gravatar image

accept rate: 32%

edited 07 Oct '17, 20:09

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: 07 Oct '17, 17:19

question was seen: 3,031 times

last updated: 07 Oct '17, 20:09

powered by OSQA