Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vasturiano/three-geojson-geometry
ThreeJS geometry to stroke GeoJSON objects on a sphere
https://github.com/vasturiano/three-geojson-geometry
data-visualization geojson maps three-js webgl
Last synced: 7 days ago
JSON representation
ThreeJS geometry to stroke GeoJSON objects on a sphere
- Host: GitHub
- URL: https://github.com/vasturiano/three-geojson-geometry
- Owner: vasturiano
- License: mit
- Created: 2019-09-10T03:01:32.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-04T19:09:56.000Z (5 months ago)
- Last Synced: 2024-12-10T23:05:44.316Z (14 days ago)
- Topics: data-visualization, geojson, maps, three-js, webgl
- Language: JavaScript
- Homepage: https://vasturiano.github.io/three-geojson-geometry/example/countries/
- Size: 606 KB
- Stars: 70
- Watchers: 4
- Forks: 15
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
ThreeJS GeoJSON Geometry
========================[![NPM package][npm-img]][npm-url]
[![Build Size][build-size-img]][build-size-url]
[![NPM Downloads][npm-downloads-img]][npm-downloads-url]A ThreeJS geometry class for stroking GeoJSON objects on a sphere.
## Quick start
```js
import GeoJsonGeometry from 'three-geojson-geometry';
```
or using a *script* tag
```html```
then
```js
const myLine = new THREE.Line(
new GeoJsonGeometry(geoJson),
new THREE.LineBasicMaterial({ color: 'blue' })
);```
## API reference
### Constructor
GeoJsonGeometry(geoJson: GeoJson object, radius: Float, resolution: Float)
* geoJson: A GeoJson `geometry` object. It's recommended to split the geometries at the [anti-meridian](https://en.wikipedia.org/wiki/180th_meridian).
* radius: Radius of the sphere surface to draw the poygon on. Default is `1`.
* resolution: Resolution of the sphere, in lat/lng degrees. If the distance between two adjacent line points is larger than this value, the line segment will be interpolated in order to approximate the curvature of the sphere surface. Lower values yield more perfectly curved lines, at the cost of performance. Default is `5`.### 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.
* 0: The outer ring of the polygon.
* 1: The polygon inner holes (if any).### Object types
Different geoJson types should be represented using different ThreeJS object types:
* `Point` and `MultiPoints` - Use `THREE.Points`
* `LineString` and `Polygon` - Use `THREE.Line`
* `MultiLineString` and `MultiPolygon` - Use `THREE.LineSegments`[npm-img]: https://img.shields.io/npm/v/three-geojson-geometry
[npm-url]: https://npmjs.org/package/three-geojson-geometry
[build-size-img]: https://img.shields.io/bundlephobia/minzip/three-geojson-geometry
[build-size-url]: https://bundlephobia.com/result?p=three-geojson-geometry
[npm-downloads-img]: https://img.shields.io/npm/dt/three-geojson-geometry
[npm-downloads-url]: https://www.npmtrends.com/three-geojson-geometry