vasturiano / three-geojson-geometry

ThreeJS geometry to stroke GeoJSON objects on a sphere
https://vasturiano.github.io/three-geojson-geometry/example/countries/
MIT License
61 stars 15 forks source link
data-visualization geojson maps three-js webgl

ThreeJS GeoJSON Geometry

NPM package Build Size NPM Downloads

A ThreeJS geometry class for stroking GeoJSON objects on a sphere.

Quick start

import { GeoJsonGeometry } from 'three-geojson-geometry';

or using a script tag

<script src="https://github.com/vasturiano/three-geojson-geometry/raw/master//unpkg.com/three-geojson-geometry"></script>

then

const myLine = new THREE.Line(
  new GeoJsonGeometry(geoJson),
  new THREE.LineBasicMaterial({ color: 'blue' })
);

API reference

Constructor

GeoJsonGeometry(geoJson: GeoJson object, radius: Float, resolution: Float)

Properties

.parameters: Object

An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.

Groups

When generating Polygon or MultiPolygon geometries, two groups are provided to which different materials can be applied.

Object types

Different geoJson types should be represented using different ThreeJS object types: