<p>At least in the <a href="http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Print_.28out.29">documentation</a>  I could not find an explicit hint how <code>bounds</code> should behave in the context of <code>out geom(...)</code>: </p>

<blockquote>
<p>The attribute "geom" can be followed by a bounding box in the format "(south,west,north,east)". In this case only coordinates that are inside the bounding box are produced. For way segments also the first coordinate outside the bounding box is produced to allow for properly formed segments. </p>
</blockquote>

<p>I assume that only those nodes which are produced by <code>out geom(...)</code> would also count towards the <code>bounds</code> element.</p>

<p><a href="https://github.com/drolbr" class="user-mention">@drolbr</a> : Roland, can you please comment on this one? Am I missing something here or is this all works as designed?</p>

<p>Maybe adding another <code>out bb ids;</code> would be an option to produce a full bounding box without repeating all data again:</p>

<div class="highlight highlight-source-c"><pre>[timeout:<span class="pl-c1">5</span>][out:json];is_in(<span class="pl-c1">39.6163</span>,-<span class="pl-c1">74.5054</span>)->.a;way(pivot.a);
out tags <span class="pl-en">geom</span>(<span class="pl-c1">39.59927344095099</span>,-<span class="pl-c1">74.5391035079956</span>,<span class="pl-c1">39.633324269501465</span>,-<span class="pl-c1">74.4717264175415</span>);
out bb ids;relation(pivot.a);out tags bb;</pre></div>

<p>This returns an additional way with id and unclipped  <code>bounds</code> details and should be usable for sorting purposes.</p>

<div class="highlight highlight-source-json"><pre>{
  <span class="pl-s"><span class="pl-pds">"</span>type<span class="pl-pds">"</span></span>: <span class="pl-s"><span class="pl-pds">"</span>way<span class="pl-pds">"</span></span>,
  <span class="pl-s"><span class="pl-pds">"</span>id<span class="pl-pds">"</span></span>: <span class="pl-c1">33832747</span>,
  <span class="pl-s"><span class="pl-pds">"</span>bounds<span class="pl-pds">"</span></span>: {
    <span class="pl-s"><span class="pl-pds">"</span>minlat<span class="pl-pds">"</span></span>: <span class="pl-c1">39.1919712</span>,
    <span class="pl-s"><span class="pl-pds">"</span>minlon<span class="pl-pds">"</span></span>: <span class="pl-c1">-75.0191372</span>,
    <span class="pl-s"><span class="pl-pds">"</span>maxlat<span class="pl-pds">"</span></span>: <span class="pl-c1">40.1129889</span>,
    <span class="pl-s"><span class="pl-pds">"</span>maxlon<span class="pl-pds">"</span></span>: <span class="pl-c1">-74.2086371</span>
  }</pre></div>

<p>Of course there's also the option to have ways behave like relations via <code>out bb tags;</code> </p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/openstreetmap/openstreetmap-website/issues/1156#issuecomment-192982379">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABWnLUHxdvgu25jB5fso3dIvCX12cN5pks5pqzfkgaJpZM4HbSi1.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/openstreetmap/openstreetmap-website/issues/1156#issuecomment-192982379"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>