# @webgeodatavore/geojson.terminator

> GeoJSON Night and day regions on Earth

Latest version **1.0.2** (published 2018-09-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @webgeodatavore/geojson.terminator
pnpm add @webgeodatavore/geojson.terminator
yarn add @webgeodatavore/geojson.terminator
bun add @webgeodatavore/geojson.terminator
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-09-02 |
| First published | 2018-09-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Thomas Gratier |
| Maintainers | thomasg77 |
| Keywords | geojson, terminator |

## Links

- npm: https://www.npmjs.com/package/@webgeodatavore/geojson.terminator
- Repository: https://github.com/webgeodatavore/GeoJSON.Terminator
- Homepage: https://github.com/webgeodatavore/GeoJSON.Terminator#readme
- Issues: https://github.com/webgeodatavore/GeoJSON.Terminator/issues
- npm.io page: https://npm.io/package/@webgeodatavore/geojson.terminator

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-09-02
- 1.0.1 — 2018-09-02
- 1.0.0 — 2018-09-01

## README

# GeoJSON Terminator

Create a GeoJSON of overlay day and night regions.
It's derivated from [Leaflet-Terminator](https://github.com/joergdietrich/Leaflet.Terminator) project

## Demo

You can see a [demo in action](https://rawgit.com/webgeodatavore/GeoJSON.Terminator/master/demo/index.html) using OpenLayers

It generates a 'pseudo-GeoJSON'.

## Why 'pseudo'?

Coordinates longitude range go from -360 to 360 whereas it should be -180, + 180

API like OpenLayers or Leaflet can consume this GeoJSON although it's invalid from the GeoJSON spec viewpoint.

If you need a valid GeoJSON in another context, you may use something like GDAL/OGR to clip GeoJSON to a valid range with:

    ogr2ogr -f "GeoJSON" output.geojson input.geojson \
            -clipsrc -180 90 180 90

## Usage


### With OpenLayers standalone build

    var geoJSON = new GeoJSONTerminator();
    var timeLayer = new ol.layer.Vector({
      source: new ol.source.Vector({
        features: (new ol.format.GeoJSON()).readFeatures(geoJSON, {
          featureProjection: 'EPSG:3857'
        })
      }),
      style: new ol.style.Style({
        fill: new ol.style.Fill({
          color: 'rgb(0, 0, 0)'
        }),
        stroke: null
      }),
      opacity: 0.5
    });
    map.addLayer(timeLayer);

## With npm

    // At the beginning
    import VectorLayer from 'ol/layer/Vector';
    import VectorSource from 'ol/source/Vector';
    import GeoJSON from 'ol/format/GeoJSON';
    import Style from 'ol/style/Style';
    import Stroke from 'ol/style/Stroke';
    import Fill from 'ol/style/Fill';
    import GeoJSONTerminator from "@webgeodatavore/geojson.terminator";


    // Then after map instanciation

    const geoJSON = new GeoJSONTerminator();
    const timeLayer = new VectorLayer({
      source: new VectorSource({
        features: (new GeoJSON()).readFeatures(geoJSON, {
          featureProjection: 'EPSG:3857'
        })
      }),
      style: new Style({
        fill: new Fill({
          color: 'rgb(0, 0, 0)'
        }),
        stroke: null
      }),
      opacity: 0.5
    });
    map.addLayer(timeLayer);

---
_Source: https://npm.io/package/@webgeodatavore/geojson.terminator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
