Ox.API: better workaround for area
This commit is contained in:
parent
0d802a16c9
commit
76a540e399
1 changed files with 15 additions and 3 deletions
|
@ -224,12 +224,24 @@ Ox.api = function(items, options) {
|
||||||
east: data.area.ne.lng
|
east: data.area.ne.lng
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
data.area = {
|
data.area = items.length == 0 ? {
|
||||||
south: Ox.MIN_LATITUDE,
|
south: -Ox.MAX_LATITUDE,
|
||||||
west: -180,
|
west: -180,
|
||||||
north: Ox.MAX_LATITUDE,
|
north: Ox.MAX_LATITUDE,
|
||||||
east: 180
|
east: 180
|
||||||
}
|
} : items.reduce(function(prev, curr) {
|
||||||
|
return {
|
||||||
|
south: Ox.min(prev.south, curr.south),
|
||||||
|
west: Ox.min(prev.west, curr.west),
|
||||||
|
north: Ox.max(prev.north, curr.north),
|
||||||
|
east: Ox.max(prev.east. curr.east)
|
||||||
|
};
|
||||||
|
}, {
|
||||||
|
south: Ox.MAX_LATITUDE,
|
||||||
|
west: 180,
|
||||||
|
north: -Ox.MAX_LATITUDE,
|
||||||
|
east: -180
|
||||||
|
});
|
||||||
}
|
}
|
||||||
result.data = data;
|
result.data = data;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue