Open Mashin6 opened 3 years ago
As you're effectively proposing a breaking change here, I believe this would only be possible by introducing another "out" modifier, which would have to be implemented for every other output format, like json, csv, etc.. That's more code complexity for maybe not an immediately clear benefit.
Fair point, I don't know how many tools depend on this behavior. CSV output behaves correctly as far as I remember (only problem is lack of error messages when query fails).
It is just weird that when I want center, overpass doesn't give me center.
e.g. trying simple out center;
return lots of "unwanted" information and I though that this was part of a bigger issue.
<way id="51040572">
<center lat="49.4742319" lon="16.2569839"/>
<nd ref="650824955"/>
<nd ref="650824953"/>
<nd ref="650824949"/>
<nd ref="650824948"/>
<nd ref="650824955"/>
<tag k="dibavod:id" v="415010660015"/>
<tag k="natural" v="water"/>
<tag k="source" v="vuv:dibavod:a05"/>
<tag k="water" v="reservoir"/>
</way>
By the way, this pretty much works as documented here: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#out
center: This adds only the center of the above mentioned bounding box to ways and relations.
Ah OK. That makes sense then.
Found your post on Slack. I'd say you don't really need XML output for your use case anyway. CSV would do fine, processing issues can be recognized using an additional totals row towards the end.
[out:csv(::lat,::lon, ::count; false; " ")][bbox:{{bbox}}];
nwr[building];
out qt center;
out count;
That was actually the original version. The problem was that csv output does not report when something goes wrong with the query and I couldn't distinguished failed requests or no data return.
I’m not sure I’m following you. If the query fails b/c of timeout or memory issues, the last control row would always be missing as the query terminated earlier.
Oh you mean the final count. That's an interesting trick I haven't thought of. Thanks!
XML output works well now with a bit of crazy parsing grep "lat"| cut -f 2 -d "a" | cut -f 2,4 -d '"' | tr '"' ','
, but switching to csv will save time by downloading only the necessary data.
I added some more comments on slack…
Thank you for the input. The more likely way forward is to figure out a way for error messages in the CSV format. Thus I'm marking this one as a wontfix.
Currently when trying to retrieve center in xml format the nodes output is different. e.g.
returns:
I think better would be to keep the formatting same across objects so nodes would be reported as