Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions src/ui/public/vislib/visualizations/_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,25 +251,37 @@ export default function MapFactory(Private, tilemap, $sanitize) {
// TODO: Different drawTypes need differ info. Need a switch on the object creation
const bounds = e.layer.getBounds();

let SElng = bounds.getSouthEast().lng;
if (SElng > 180) {
SElng -= 360;
const southEast = bounds.getSouthEast();
const northWest = bounds.getNorthWest();
let SouthEastLng = southEast.lng;
if (SouthEastLng > 180) {
SouthEastLng -= 360;
}
let NWlng = bounds.getNorthWest().lng;
if (NWlng < -180) {
NWlng += 360;
let NorthWestLng = northWest.lng;
if (NorthWestLng < -180) {
NorthWestLng += 360;
}

const SouthEastLat = southEast.lat;
const NorthWestLat = northWest.lat;

//Bounds cannot be created unless they form a box with larger than 0 dimensions
//Invalid areas are rejected by ES.
if (SouthEastLat === NorthWestLat || SouthEastLng === NorthWestLng) {
return;
}

self._events.emit(drawType, {
e: e,
chart: self._chartData,
bounds: {
top_left: {
lat: bounds.getNorthWest().lat,
lon: NWlng
},
bottom_right: {
lat: bounds.getSouthEast().lat,
lon: SElng
lat: SouthEastLat,
lon: SouthEastLng
},
top_left: {
lat: NorthWestLat,
lon: NorthWestLng
}
}
});
Expand Down