[openstreetmap-website] TypeError: t.bounds is undefined - object query triggers javascript error because Overpass API result doesn't include bbox (#1156)

mmd notifications at github.com
Tue Feb 16 16:18:23 UTC 2016


For full details, please refer to this post first: https://help.openstreetmap.org/questions/48088/what-makes-a-closed-way-show-up-as-an-enclosing-feature-with-query-features

**How to reproduce:** http://www.openstreetmap.org/query?lat=39.6181&lon=-74.5019#map=15/39.6176/-74.4857

-> Although there are several enclosing features, none of them are shown. Javascript console shows the following error message: TypeError: t.bounds is undefined


```C
[timeout:5][out:json];is_in(39.6163,-74.5054)->.a;way(pivot.a);
out tags geom(39.59927344095099,-74.5391035079956,39.633324269501465,-74.4717264175415);relation(pivot.a);out tags bb;
```

Overpass result:
```
  "type": "way",
  "id": 33832747,
  "geometry": [
...

    null,
    null,
    null,
    null
  ],
  "tags": {
    "area": "yes",
    "boundary": "national_park",
    "name": "Pinelands National Reserve"
  }
},
```

Issue: Overpass API result doesn't include a `bounds` tags for way 33832747 - because all of it's nodes are outside the specified bounding box, so there's no meaningful bounding box which could be provided.

This triggers a javascript error in the following function, because t doesn't have a bounds element.
```
    function i(t, e) {
        var n = t.bounds.maxlon - t.bounds.minlon
          , o = t.bounds.maxlat - t.bounds.minlat
          , a = n * o
          , r = e.bounds.maxlat - e.bounds.minlat
          , i = e.bounds.maxlat - e.bounds.minlat
          , s = r * i;
        return a - s
    }
```

I'd suggest to filter out results without bounds to avoid the 




---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/1156
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20160216/ffaa9a6b/attachment.html>


More information about the rails-dev mailing list