GeoJsonPrimitive

Lightweight GeoJSON loader that converts features directly into BufferPointCollection, BufferPolylineCollection, and BufferPolygonCollection. Unlike GeoJsonDataSource, this path does not create entities. Instead, it exposes high-throughput buffer primitive collections that can be added directly to Scene#primitives.

new Cesium.GeoJsonPrimitive(options)

Name Type Description
options GeoJsonPrimitiveConstructorOptions optional
Example:
const loader = await Cesium.GeoJsonPrimitive.fromUrl("./data.geojson");
viewer.scene.primitives.add(loader);

loader.points;     // BufferPointCollection | undefined
loader.polylines;  // BufferPolylineCollection | undefined
loader.polygons;   // BufferPolygonCollection | undefined
loader.ids;        // source feature IDs
loader.properties; // source feature properties
Experimental

This feature is not final and is subject to change without Cesium's standard deprecation policy.

Members

readonly featureCount : number

Feature count represented by the loaded collections.

readonly ids : Array.<(string|number|undefined)>

Lookup table from integer ID generated by GeoJsonPrimitive, to integer or string Feature ID from GeoJSON source.
Buffer point collection for point geometries.
Buffer polygon collection for polygon geometries.
Buffer polyline collection for linestring geometries.

readonly properties : Array.<Record.<string, unknown>>

Source GeoJSON properties, indexed by generated integer ID.

readonly url : string|undefined

Loader source URL when created via GeoJsonPrimitive.fromUrl.

Methods

static Cesium.GeoJsonPrimitive.fromGeoJson(geoJson, options)GeoJsonPrimitive

Creates a loader directly from a parsed GeoJSON object.
Name Type Description
geoJson object
options GeoJsonPrimitiveConstructorOptions optional
Returns:

async static Cesium.GeoJsonPrimitive.fromUrl(url, options)Promise.<GeoJsonPrimitive>

Loads GeoJSON from a URL or Resource.
Name Type Description
url Resource | string
options GeoJsonPrimitiveConstructorOptions optional
Returns:
Name Type Description
featureId number
Name Type Description
featureId number
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.