diff --git a/Source/DataSources/KmlDataSource.js b/Source/DataSources/KmlDataSource.js index a4759abcc3fc..b1986838948f 100644 --- a/Source/DataSources/KmlDataSource.js +++ b/Source/DataSources/KmlDataSource.js @@ -1413,13 +1413,13 @@ define([ var north = queryNumericValue(latLonBox, 'north', namespaces.kml); if (defined(west)) { - west = CesiumMath.convertLongitudeRange(CesiumMath.toRadians(west)); + west = CesiumMath.negativePiToPi(CesiumMath.toRadians(west)); } if (defined(south)) { south = CesiumMath.negativePiToPi(CesiumMath.toRadians(south)); } if (defined(east)) { - east = CesiumMath.convertLongitudeRange(CesiumMath.toRadians(east)); + east = CesiumMath.negativePiToPi(CesiumMath.toRadians(east)); } if (defined(north)) { north = CesiumMath.negativePiToPi(CesiumMath.toRadians(north)); diff --git a/Specs/DataSources/KmlDataSourceSpec.js b/Specs/DataSources/KmlDataSourceSpec.js index 7d16b0f754a7..38d14242165f 100644 --- a/Specs/DataSources/KmlDataSourceSpec.js +++ b/Specs/DataSources/KmlDataSourceSpec.js @@ -668,6 +668,24 @@ defineSuite([ }); }); + it('GroundOverlay: Handles wrapping longitude.', function() { + var kml = '\ + \ + \ + -180\ + -90\ + 180\ + 90\ + \ + '; + + return KmlDataSource.load(parser.parseFromString(kml, "text/xml")).then(function(dataSource) { + var entity = dataSource.entities.values[0]; + expect(entity.polygon).toBeUndefined(); + expect(entity.rectangle.coordinates.getValue()).toEqual(Rectangle.fromDegrees(-180, -90, 180, 90)); + }); + }); + it('GroundOverlay: Sets polygon coordinates for gx:LatLonQuad', function() { var kml = '\