# GeoJsonDataSource

#### new Cesium.GeoJsonDataSource(name)
DataSources/GeoJsonDataSource.js 513

  A `DataSource` which processes both GeoJSON and TopoJSON data. simplestyle-spec properties will also be used if they are present.

  Name | Type | Description
  --- | --- | ---
  `name` | String | optional The name of this data source. If undefined, a name will be taken from the name of the GeoJSON file.

  ##### Example:

      var viewer = new Cesium.Viewer('cesiumContainer');
      viewer.dataSources.add(Cesium.GeoJsonDataSource.load('../../SampleData/ne_10m_us_states.topojson', {
        stroke: Cesium.Color.HOTPINK,
        fill: Cesium.Color.PINK,
        strokeWidth: 3,
        markerSymbol: '?'
      }));

  ##### Demo:

  - Cesium Sandcastle GeoJSON and TopoJSON Demo
  - Cesium Sandcastle GeoJSON simplestyle Demo

### Members

#### staticCesium.GeoJsonDataSource.clampToGround : Boolean
DataSources/GeoJsonDataSource.js 640

  Gets or sets default of whether to clamp to the ground.
  Default Value: `false`

#### staticCesium.GeoJsonDataSource.crsLinkHrefs : Object
DataSources/GeoJsonDataSource.js 672

  Gets an object that maps the href property of a crs link to a callback function which takes the crs properties object and returns a Promise that resolves to a function that takes a GeoJSON coordinate and transforms it into a WGS84 Earth-fixed Cartesian. Items in this object take precedence over those defined in `crsLinkHrefs`, assuming the link has a type specified.

#### staticCesium.GeoJsonDataSource.crsLinkTypes : Object
DataSources/GeoJsonDataSource.js 686

  Gets an object that maps the type property of a crs link to a callback function which takes the crs properties object and returns a Promise that resolves to a function that takes a GeoJSON coordinate and transforms it into a WGS84 Earth-fixed Cartesian. Items in `crsLinkHrefs` take precedence over this object.

#### staticCesium.GeoJsonDataSource.crsNames : Object
DataSources/GeoJsonDataSource.js 657

  Gets an object that maps the name of a crs to a callback function which takes a GeoJSON coordinate and transforms it into a WGS84 Earth-fixed Cartesian. Older versions of GeoJSON which supported the EPSG type can be added to this list as well, by specifying the complete EPSG name, for example 'EPSG:4326'.

#### staticCesium.GeoJsonDataSource.fill : Color
DataSources/GeoJsonDataSource.js 625

  Gets or sets default color for polygon interiors.
  Default Value: `Color.YELLOW`

#### staticCesium.GeoJsonDataSource.markerColor : Color
DataSources/GeoJsonDataSource.js 581

  Gets or sets the default color of the map pin created for each point.
  Default Value: `Color.ROYALBLUE`

#### staticCesium.GeoJsonDataSource.markerSize : Number
DataSources/GeoJsonDataSource.js 552

  Gets or sets the default size of the map pin created for each point, in pixels.
  Default Value: `48`

#### staticCesium.GeoJsonDataSource.markerSymbol : String
DataSources/GeoJsonDataSource.js 567

  Gets or sets the default symbol of the map pin created for each point. This can be any valid Maki identifier, any single character, or blank if no symbol is to be used.

#### staticCesium.GeoJsonDataSource.stroke : Color
DataSources/GeoJsonDataSource.js 595

  Gets or sets the default color of polylines and polygon outlines.
  Default Value: `Color.BLACK`

#### staticCesium.GeoJsonDataSource.strokeWidth : Number
DataSources/GeoJsonDataSource.js 610

  Gets or sets the default width of polylines and polygon outlines.
  Default Value: `2.0`

#### changedEvent : Event
DataSources/GeoJsonDataSource.js 738

  Gets an event that will be raised when the underlying data changes.

#### clock : DataSourceClock
DataSources/GeoJsonDataSource.js 709

  This DataSource only defines static data, therefore this property is always undefined.

#### clustering : EntityCluster
DataSources/GeoJsonDataSource.js 783

  Gets or sets the clustering options for this data source. This object can be shared between multiple data sources.

#### entities : EntityCollection
DataSources/GeoJsonDataSource.js 718

  Gets the collection of `Entity` instances.

#### errorEvent : Event
DataSources/GeoJsonDataSource.js 748

  Gets an event that will be raised if an error is encountered during processing.

#### isLoading : Boolean
DataSources/GeoJsonDataSource.js 728

  Gets a value indicating if the data source is currently loading data.

#### loadingEvent : Event
DataSources/GeoJsonDataSource.js 758

  Gets an event that will be raised when the data source either starts or stops loading.

#### name : String
DataSources/GeoJsonDataSource.js 699

  Gets a human-readable name for this instance.

#### show : Boolean
DataSources/GeoJsonDataSource.js 768

  Gets whether or not this data source should be displayed.

### Methods

#### staticCesium.GeoJsonDataSource.load(data, options) → Promise.<GeoJsonDataSource>
DataSources/GeoJsonDataSource.js 541

  Creates a Promise to a new instance loaded with the provided GeoJSON or TopoJSON data.

  Name | Type | Description
  --- | --- | ---
  `data` | String | Object | A url, GeoJSON object, or TopoJSON object to be loaded.

  `options`

  Object

  optional An object with the following properties:

  Name | Type | Default | Description
  --- | --- | --- | ---
  `sourceUri` | String |  | optional Overrides the url to use for resolving relative links.
  `markerSize` | Number | `GeoJsonDataSource.markerSize` | optional The default size of the map pin created for each point, in pixels.
  `markerSymbol` | String | `GeoJsonDataSource.markerSymbol` | optional The default symbol of the map pin created for each point.
  `markerColor` | Color | `GeoJsonDataSource.markerColor` | optional The default color of the map pin created for each point.
  `stroke` | Color | `GeoJsonDataSource.stroke` | optional The default color of polylines and polygon outlines.
  `strokeWidth` | Number | `GeoJsonDataSource.strokeWidth` | optional The default width of polylines and polygon outlines.
  `fill` | Color | `GeoJsonDataSource.fill` | optional The default color for polygon interiors.
  `clampToGround` | Boolean | `GeoJsonDataSource.clampToGround` | optional true if we want the geometry features (polygons or linestrings) clamped to the ground. If true, lines will use corridors so use Entity.corridor instead of Entity.polyline.

  ##### Returns:

  A promise that will resolve when the data is loaded.

#### load(data, options) → Promise.<GeoJsonDataSource>
DataSources/GeoJsonDataSource.js 816

  Asynchronously loads the provided GeoJSON or TopoJSON data, replacing any existing data.

  Name | Type | Description
  --- | --- | ---
  `data` | String | Object | A url, GeoJSON object, or TopoJSON object to be loaded.

  `options`

  Object

  optional An object with the following properties:

  Name | Type | Default | Description
  --- | --- | --- | ---
  `sourceUri` | String |  | optional Overrides the url to use for resolving relative links.
  `describe` | GeoJsonDataSource~describe | `GeoJsonDataSource.defaultDescribeProperty` | optional A function which returns a Property object (or just a string), which converts the properties into an html description.
  `markerSize` | Number | `GeoJsonDataSource.markerSize` | optional The default size of the map pin created for each point, in pixels.
  `markerSymbol` | String | `GeoJsonDataSource.markerSymbol` | optional The default symbol of the map pin created for each point.
  `markerColor` | Color | `GeoJsonDataSource.markerColor` | optional The default color of the map pin created for each point.
  `stroke` | Color | `GeoJsonDataSource.stroke` | optional The default color of polylines and polygon outlines.
  `strokeWidth` | Number | `GeoJsonDataSource.strokeWidth` | optional The default width of polylines and polygon outlines.
  `fill` | Color | `GeoJsonDataSource.fill` | optional The default color for polygon interiors.
  `clampToGround` | Boolean | `GeoJsonDataSource.clampToGround` | optional true if we want the features clamped to the ground.

  ##### Returns:

  a promise that will resolve when the GeoJSON is loaded.

### Type Definitions

#### describe(properties, nameProperty)
DataSources/GeoJsonDataSource.js 926

  This callback is displayed as part of the GeoJsonDataSource class.

  Name | Type | Description
  --- | --- | ---
  `properties` | Object | The properties of the feature.
  `nameProperty` | String | The property key that Cesium estimates to have the name of the feature.