Skip to content

Commit

Permalink
data/map: Wrap decimal degrees to 0 < x < 360
Browse files Browse the repository at this point in the history
When navigating east/west, the longitude increases indefinely.  So if
you wrap around the globe three times to the west, you end up at 3 * 360
degrees west.  The fix in 863f70a only
handled the wrap around the date line, not around the world several
times.

[ci skip]

Fixes #327
  • Loading branch information
ksshannon committed Feb 20, 2019
1 parent 9a88e2f commit 543cf67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 8 additions & 6 deletions data/map.htm
Expand Up @@ -124,12 +124,14 @@
function mbr() {
if(mbrLayer.getLayers().length > 0){
var b = mbrLayer.getLayers()[0]._bounds;
if(b._southWest.lng < -180) {
b._southWest.lng += 360;
}
if(b._northEast.lng < -180) {
b._northEast.lng += 360;
}
b._southWest.lng = b._southWest.lng % 360;
if(b._southWest.lng < -180) {
b._southWest.lng += 360;
}
b._northEast.lng = b._northEast.lng % 360;
if(b._northEast.lng < -180) {
b._northEast.lng += 360;
}
return [b._southWest.lng, b._northEast.lng, b._southWest.lat, b._northEast.lat];
}
return null;
Expand Down
1 change: 0 additions & 1 deletion src/gui/WidgetDownloadDEM.cpp
Expand Up @@ -210,7 +210,6 @@ void WidgetDownloadDEM::saveDEM()
qDebug()<<"no mbr";
return;
}
qDebug()<<mbr;
QVariantList mbrl = mbr.toList();
for(int i=0; i < mbrl.size(); i++) {
qDebug() << mbrl[i];
Expand Down

0 comments on commit 543cf67

Please sign in to comment.