Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treats null crs values as a no-op instead of failing to load #4456

Merged
merged 2 commits into from
Oct 19, 2016
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Change Log
* Fixed a bug with rotated, textured rectangles. [#4430](https://github.com/AnalyticalGraphicsInc/cesium/pull/4430)
* Fixed a bug when morphing from 2D to 3D. [#4388](https://github.com/AnalyticalGraphicsInc/cesium/pull/4388)
* Fixed a bug where when KML features had duplicate IDs, only one was drawn. [#3941](https://github.com/AnalyticalGraphicsInc/cesium/issues/3941)
* `GeoJsonDataSource` now treats null crs values as a no-op instead of failing to load.
* `GeoJsonDataSource` now gracefully handles missing style icons instead of failing to load.
* Added `Rectangle.simpleIntersection`.
* Added the ability to specify retina options, such as `@2x.png`, via the `MapboxImageryProvider` `format` option.
* 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.
Expand Down
13 changes: 7 additions & 6 deletions Source/DataSources/GeoJsonDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,12 +871,8 @@ define([
}

//Check for a Coordinate Reference System.
var crsFunction = defaultCrsFunction;
var crs = geoJson.crs;

if (crs === null) {
throw new RuntimeError('crs is null.');
}
var crsFunction = crs !== null ? defaultCrsFunction : null;

if (defined(crs)) {
if (!defined(crs.properties)) {
Expand Down Expand Up @@ -912,7 +908,12 @@ define([

return when(crsFunction, function(crsFunction) {
that._entityCollection.removeAll();
typeHandler(that, geoJson, geoJson, crsFunction, options);

// null is a valid value for the crs, but means the entire load process becomes a no-op
// because we can't assume anything about the coordinates.
if (crsFunction !== null) {
typeHandler(that, geoJson, geoJson, crsFunction, options);
}

return when.all(that._promises, function() {
that._promises.length = 0;
Expand Down
7 changes: 2 additions & 5 deletions Specs/DataSources/GeoJsonDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1133,11 +1133,8 @@ defineSuite([
crs : null
};

return GeoJsonDataSource.load(featureWithNullCrs).then(function() {
fail('should not be called');
}).otherwise(function(error) {
expect(error).toBeInstanceOf(RuntimeError);
expect(error.message).toContain('crs is null.');
return GeoJsonDataSource.load(featureWithNullCrs).then(function(dataSource) {
expect(dataSource.entities.values.length).toBe(0);
});
});

Expand Down