Cesium GeoJSON update

by Adam Granger

HTML

<script src="https://cesiumjs.org/Cesium/Build/Cesium/Cesium.js"></script>
<link rel="stylesheet" href="https://cesiumjs.org/Cesium/Build/Cesium/Widgets/widgets.css">
<div id="cesiumContainer"></div>

CSS

html {
          height: 100%;
      }
      body {
          padding: 0;
          margin: 0;
          overflow: hidden;
          height: 100%;
      }

JavaScript

var viewer = new Cesium.Viewer('cesiumContainer');
    var source = new Cesium.GeoJsonDataSource("name123");
    viewer.dataSources.add(source);
    
    source.load({
        type: "FeatureCollection",
        crs: {
            type: "name",
            properties: {
                name: "urn:ogc:def:crs:OGC:1.3:CRS84"
            }
        },
        features: [{
            type: "Feature",
            properties: {
                foo: 123,
            },
            geometry: {
                type: "Point",
                coordinates: [0.1275, 51.5072] // London
            },
            id: "123"
        }]
    });
        
    // source.entities.removeAll();
    
    // sometime later...
    source.load({
        type: "FeatureCollection",
        crs: {
            type: "name",
            properties: {
                name: "urn:ogc:def:crs:OGC:1.3:CRS84"
            }
        },
        features: [{
            type: "Feature",
            properties: {
                foo: 456,
            },
            geometry: {
                type: "Point",
                coordinates: [-75.1890, 42.3482] // New York
            },
            id: "123"
        }]
    });