[cesium-dev] Load multiple geoJSON files

There are a few problems with your code. GeoJsonDataSource is a constructor, so you should create one instance per file. You may also have better results if you add the instances to the dataSources collection after they have finished loading.

Here’s some working example code that loads two GeoJSON files:

var viewer = new Cesium.Viewer('cesiumContainer');

var dataSource1 = new Cesium.GeoJsonDataSource();

dataSource1.loadUrl('/Nevada.geojson').then(function() {

    viewer.dataSources.add(dataSource1);

});

var dataSource2 = new Cesium.GeoJsonDataSource();

dataSource2.loadUrl('/New_Hampshire.geojson').then(function() {

    viewer.dataSources.add(dataSource2);

});