# GeoJSONLoader

class in `three-geojson`

```js
import { GeoJSONLoader } from 'three-geojson';
```

Loader and parser for the [GeoJSON](https://geojson.org/) format.

Example: Extruding a GeoJSON polygon

```js
import { MeshNormalMaterial } from 'three';
import { GeoJSONLoader } from 'three-geojson';

// scene, camera and renderer are initialized here

// a square with a square hole
const result = new GeoJSONLoader().parse( {
	type: 'Polygon',
	coordinates: [
		[ [ - 1, - 1 ], [ 1, - 1 ], [ 1, 1 ], [ - 1, 1 ], [ - 1, - 1 ] ],
		[ [ - 0.5, - 0.5 ], [ - 0.5, 0.5 ], [ 0.5, 0.5 ], [ 0.5, - 0.5 ], [ - 0.5, - 0.5 ] ],
	],
} );

const mesh = result.polygons[ 0 ].getMeshObject( { thickness: 0.4 } );
mesh.material = new MeshNormalMaterial();
mesh.rotation.x = - Math.PI / 2;
scene.add( mesh );
```

## Properties

### .fetchOptions: Object

default `{}`

Options passed to `fetch` when loading a file.

## Methods

### getLineObject

```js
getLineObject( objects: Array<(Polygon|LineString)>, options?: LineOptions ): LineSegments
```

Returns a line that merges the result of all the provided Polygons and LineStrings. Each
result is defined as a separate group in the resulting geometry.

- `objects`, `Array<(Polygon|LineString)>`
- `options`, `LineOptions`, optional

### getMeshObject

```js
getMeshObject( objects: Array<Polygon>, options?: MeshOptions ): Mesh
```

Returns a mesh that merges the result of all the provided Polygons. Each result is defined as
a separate group in the resulting geometry in top cap, bottom cap, side geometry order.

- `objects`, `Array<Polygon>`
- `options`, `MeshOptions`, optional

### .loadAsync

```js
.loadAsync( url: string ): Promise<GeoJSONResult>
```

Loads and parses a GeoJSON file.

- `url`, `string`

### .parse

```js
.parse( json: string | Object ): GeoJSONResult
```

Parses GeoJSON content. Takes a raw or stringified json object.

- `json`, `string | Object`
