Class: DayNight

ol.source. DayNight

DayNight source: a source to display day/night on a map


new DayNight(options, time, step)

Parameters:
Name Type Description
options any

Vector source options

time string | Date

source date time

step number

step in degree for coordinate precision

Extends

Methods


<static> getNightLat(lon, time)

Get the day/night separation latitude

Parameters:
Name Type Description
lon number
time Date
Returns:
Type
number

clear()

Overwrite ol/source/Vector clear to fire clearstart / clearend event

Inherited From:
Overrides:

getCoordinates(time, options)

Get night-day separation line

Parameters:
Name Type Description
time string

DateTime string, default yet

options string

use 'line' to get the separation line, 'day' to get the day polygon, 'night' to get the night polygon or 'daynight' to get both polygon, default 'night'

Returns:
Type
Array.<ol.Point> | Array.<Array.<ol.Point>>

getSunPosition(time)

Get sun coordinates on earth

Parameters:
Name Type Description
time string

DateTime string, default yet

Returns:

position in lonlat

Type
ol.coordinate

setTime(time)

Set source date time

Parameters:
Name Type Description
time string | Date

source date time