Skip to content

Commit eb5d0f5

Browse files
authored
Improve Postpass compatibility - support non-geodata responses and be more robust on empty responses (#788)
1 parent 3abf31b commit eb5d0f5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

js/overpass.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class Overpass {
116116
data_elements = jqXHR.responseXML.childNodes[0].childElementCount;
117117
} else if (jqXHR.responseJSON) {
118118
data_elements = (
119-
jqXHR.responseJSON.elements || jqXHR.responseJSON.features
119+
jqXHR.responseJSON.elements || jqXHR.responseJSON.features || jqXHR.responseJSON.result
120120
).length;
121121
}
122122
overpass.fire("onProgress", `received about ${data_txt} of data`);
@@ -718,7 +718,7 @@ class Overpass {
718718
// switch only if there is some unplottable data in the returned json/xml.
719719
let empty_msg;
720720
if (
721-
(data_mode == "json" && data.elements.length > 0) ||
721+
(data_mode == "json" && data.elements && data.elements.length > 0) ||
722722
(data_mode == "xml" &&
723723
$("osm", data).children().not("note,meta,bounds")
724724
.length > 0)

0 commit comments

Comments
 (0)