Skip to content

Commit c2002cc

Browse files
author
Hannah
authored
Merge pull request #4456 from AnalyticalGraphicsInc/null-crs
Treats null crs values as a no-op instead of failing to load
2 parents c384bf8 + 5ccc13e commit c2002cc

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Change Log
1414
* Fixed a bug with rotated, textured rectangles. [#4430](https://github.com/AnalyticalGraphicsInc/cesium/pull/4430)
1515
* Fixed a bug when morphing from 2D to 3D. [#4388](https://github.com/AnalyticalGraphicsInc/cesium/pull/4388)
1616
* Fixed a bug where when KML features had duplicate IDs, only one was drawn. [#3941](https://github.com/AnalyticalGraphicsInc/cesium/issues/3941)
17+
* `GeoJsonDataSource` now treats null crs values as a no-op instead of failing to load.
18+
* `GeoJsonDataSource` now gracefully handles missing style icons instead of failing to load.
1719
* Added `Rectangle.simpleIntersection`.
1820
* Added the ability to specify retina options, such as `@2x.png`, via the `MapboxImageryProvider` `format` option.
1921
* Removed an unnecessary reprojection of Web Mercator imagery tiles to the Geographic projection on load. This should improve both visual quality and load performance slightly.

Source/DataSources/GeoJsonDataSource.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -871,12 +871,8 @@ define([
871871
}
872872

873873
//Check for a Coordinate Reference System.
874-
var crsFunction = defaultCrsFunction;
875874
var crs = geoJson.crs;
876-
877-
if (crs === null) {
878-
throw new RuntimeError('crs is null.');
879-
}
875+
var crsFunction = crs !== null ? defaultCrsFunction : null;
880876

881877
if (defined(crs)) {
882878
if (!defined(crs.properties)) {
@@ -912,7 +908,12 @@ define([
912908

913909
return when(crsFunction, function(crsFunction) {
914910
that._entityCollection.removeAll();
915-
typeHandler(that, geoJson, geoJson, crsFunction, options);
911+
912+
// null is a valid value for the crs, but means the entire load process becomes a no-op
913+
// because we can't assume anything about the coordinates.
914+
if (crsFunction !== null) {
915+
typeHandler(that, geoJson, geoJson, crsFunction, options);
916+
}
916917

917918
return when.all(that._promises, function() {
918919
that._promises.length = 0;

Specs/DataSources/GeoJsonDataSourceSpec.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -1133,11 +1133,8 @@ defineSuite([
11331133
crs : null
11341134
};
11351135

1136-
return GeoJsonDataSource.load(featureWithNullCrs).then(function() {
1137-
fail('should not be called');
1138-
}).otherwise(function(error) {
1139-
expect(error).toBeInstanceOf(RuntimeError);
1140-
expect(error.message).toContain('crs is null.');
1136+
return GeoJsonDataSource.load(featureWithNullCrs).then(function(dataSource) {
1137+
expect(dataSource.entities.values.length).toBe(0);
11411138
});
11421139
});
11431140

0 commit comments

Comments
 (0)