Cesium GeoJSON and USGS Earthquakes discrepancy?

Hi All,

The USGS provides information about recent earthquakes in GeoJSON format, as seen here:


The third parameter of their geometry:coordinates object is actually the “depth of the event in kilometers.”

The Cesium GeoJSONDataSource has a defaultCrsFunction which uses the Cartesian3.fromDegrees() constructor, which assumes this third parameter is the:

“height, in meters above the ellipsiod”

I don’t see any way to pass in a crsFunction, and none of the override crs code near line 817 in GeoJsonDataSource is hit, because ‘geoJson.crs’ is undefined for this data, e.g.

So, what to do? Is the USGS wrong? Is Cesium wrong?

This depth is important, because I’m trying to draw the earthquake “inside” the sphere of the Earth.




In this instance, the USGS is incorrect and is producing invalid GeoJSON. When not specified, the default crs for GeoJSON is WGS84, here is a link to the part of the spec that discusses this: http://geojson.org/geojson-spec.html#coordinate-reference-system-objects

These files should be specifying a custom crs that indicates the third value as kilometers below the ellipsoid (I do not know off hand if such as standard crs exists, but they could easily make up their own and it would be just as valid. Since Cesium has full support for custom crs functions, it would then be trivial for you to load the corrected files properly.

That being said, I don’t expect USGS to suddenly change their output and we can certainly fix this on the Cesium side of things. While Cesium already allows for supporting custom crs by adding values to GeoJsonDataSource.crsNames, you are correct in that we currently don’t specify a way to override the default crs. This is something we could easily add to a future release.

In the meantime, not all is lost. You can handle these types of GeoJson files today with a one small extra step. I imagine you currently have code that is loading the data in a single like, something like:


This both fetches the JSON file from the server and then immediately processes it. Instead, we can fetch the JSON ourselves, add a custom CRS that does what we want, and then process it, producing your desired results. I think that looks something like the following:

//Add this line section once at program startup

Cesium.GeoJsonDataSource.crsNames.kilometersBelowEllipsoid = function(coordinates){

var kilometersBelowEllipsoid = Cesium.defaultValue(coordinates[2], 0) * -1000.0;

return Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], kilometersBelowEllipsoid);


//Load the JSON file manually, add a new crs property that matches our custom crs, and then process the modified JSON


geoJson.crs = {

type: “name”,


name: “kilometersBelowEllipsoid”



return Cesium.GeoJsonDataSource.load(geoJson);


Note, I didn’t actually run the above code, so it might need some tweaking; but it should largely work. I can’t remember offhand is crs is a top-level property or something that needs to be added to each feature. If the latter, a simple loop should fix the above code.

If you are still having problems, let us know.




Thanks so much for the quick response!… by the time I got it, I had already worked out this solution-ish for myself, so it totally makes sense.

Do you work for AGI, or do you just contribute to the source?

We might be looking for an extra pair of hands for a project we’re starting up, recreating our (old) WorldWindJava desktop app using Cesium. (http://www.thelayeredearth.com/)

  • Dave


30 more seconds of clicking and yes, of course you work for AGI.

Are you the man to come to with (otherwise unresolvable) questions about Cesium?

  • Dave

Thanks for the offer, but as you already discovered I’m slightly invested in staying where I am :wink:

Cesium being so successful means I don’t have much spare time to spend on the forum these days (I honestly miss it), but I try to pitch in every now and then on the more unique problems. Thankfully Hannah has been doing a great job keeping tabs on things.


I’m having a performance issue, and I thought you might not only be able to help, but also might be interested.

I have a file containing some 13,000 historical earthquakes (from USGS) that I’m trying to plot, each with a sphere, but ran into a performance issue.

To nail it down, I put together a small test and found that with as few as about 1000 Entities, my browser becomes unresponsive.

Am I doing something wrong? Is there a better way to do this?

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var testDataSource = new Cesium.CustomDataSource(‘TestName’);

var entityRadii = new Cesium.Cartesian3(30000.0, 30000.0, 30000.0);

var entityPointOptions = {

radii: entityRadii,

material: new Cesium.Color(0.0, 1.0, 0.0, 0.6),

outlineColor: new Cesium.Color(0.0, 1.0, 0.0, 0.6)


var ellipsoidGraphics = new Cesium.EllipsoidGraphics(entityPointOptions);

var i = 0;

var j = 0;

for (i = 0; i < 20; i++) {

for (j = 0; j < 50; j++) {


name : ‘Test Point’,

position : Cesium.Cartesian3.fromDegrees(i, j, 100),

ellipsoid : ellipsoidGraphics





Thanks for any help you can provide.

  • Dave

If you use a point primitive you should be able to do a very large number of points. We have found that the entity API does not work well with a large number of points. If you need to use the entity API use the PointGraphics object. It is a good ways off, but hopefully 3D tiles along with some other technologies such as WebGL2 and WebAssembly will get us to compiled like performance in the browser.

David, what browser/OS/video card are you using? Your example code takes a few seconds to load, but otherwise shows up fine on my system.

That being said, there is a lot of room for improvement in this area, see my post here for a glimpse at some of the issues: https://groups.google.com/d/msg/cesium-dev/F6IkY9aEG1I/8dRkhlBnLI4J

Your example seems to be memory limited more than anything else. A 64 bit browser might help out performance for you tremendously. In the long run, if your data is static, then 3D Tiles will be a the ideal solution to this once we are finished working on them: http://cesiumjs.org/2015/08/10/Introducing-3D-Tiles/ I also hope to perform a large refactoring of the Entity API when time allows that should hopefully greatly increase performance and reduce memory usage there as well.


I’m actually on OSX 10.11.3 running 64-bit Chrome (49.0.2623.87) on a MacBook Pro (2011 model) with the built-in AMD Radeon HD 6770M 1024 MB… so I don’t think it’s my config.

I was running a few other things at the same time, including a VM etc. but the platform I’m targeting is actually a Chromebook, so I’ve very performance conscious.

The example code I provided creates 1000 Ellipsoids, but really (memory) performance starts to degrade very badly up around a few thousand.

One thing I DID find when experimenting was that lowering the various “tessellation" parameters on the ellipsoid graphics greatly affected performance for many thousands of ellipsoids. E.g.:

subdivisions: 16, // default 128

stackPartitions: 16, // default 64

slicePartitions: 16 // default 64

… without very (badly) affecting the visual appearance (I only need these to look like a ‘kinda-sphere’.)

All that being said, I’m now going to experiment with using PointGraphics instead, because all I REALLY want, is for them to appear as “circles” from all angles. That should actually make things much faster.

Thanks again for your help. I’m sure I’ll need it more in the coming weeks.

  • Dave

David Whipps
Technical Director
Simulation Curriculum Corp.

FB: http://www.facebook.com/StarryNightSoftware
Twitter: @starrynightedu

m: (514)-638-0661


There appears to be a problem with the Forum right now. The page is not loading.


  • Dave

Hi Dave,

That page loads fine for me. Is it still not working for you?



Works now. Was down this AM.