worldwind-ui API / worldwind-kit / loadGeoJson
Function: loadGeoJson() ​
loadGeoJson(
worldWind,source,layer,options?):Promise<WWRenderableLayer>
Defined in: kit/src/geojson.ts:157
Loads GeoJSON (a URL, a JSON string, or an object) into a renderable layer with WorldWind's parser. Points become placemarks, lines surface polylines, polygons surface polygons; every shape carries the feature properties as userProperties, so picks return them. *
Parameters ​
worldWind ​
source ​
string | object
layer ​
options? ​
LoadGeoJsonOptions = {}
Returns ​
Promise<WWRenderableLayer>
Example ​
ts
const layer = globe.addRenderableLayer('Airports');
await loadGeoJson(globe.worldWind, '/airports.geojson', layer, {
style: ({ properties, geometryType }) =>
geometryType === 'Point'
? { point: { pushpin: properties.busy ? 'orange' : 'white', labelProperty: 'name' } }
: { polygon: { fill: 'rgba(251, 191, 36, 0.15)', stroke: '#fbbf24' } },
});