Browse Source

Merge pull request #614 from pelias/coordinate_wrapping

cleaner code: replace while() statements
pull/509/merge
Peter Johnson 9 years ago committed by GitHub
parent
commit
7ac1bd0158
  1. 10
      sanitiser/wrap.js

10
sanitiser/wrap.js

@ -34,14 +34,8 @@ function wrap( lat, lon ){
break;
}
// reduce lon
while( point.lon > 180 ){
point.lon -= 360;
}
// increase lon
while( point.lon < -180 ){
point.lon += 360;
if( point.lon > 180 || point.lon <= -180 ){
point.lon -= Math.floor(( point.lon + 180 ) / 360) * 360;
}
return point;

Loading…
Cancel
Save